PolyglotDevsLondon / sharespots

Sharespots - find co-working friendly cafes in London

Home Page:http://sharespots.co.uk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sharespots

Sharespots is a simple Django app that displays a curated list of cafes/co-working spaces to meetup and work in London.

Technology Stack

  • Backend: Python & Django
  • Front-end: SASS/HTML5/JavaScript
  • Hosting: Heroku
  • Storage: AWS S3

Tests

We use pytest for our tests To run Pytest please run this command npm run django-tests

Software Tools Required

  1. Terminal: iTerm2 (MacOSX), Terminator (Linux) or use your preferred one.
  2. Text Editor: Sublime Text or your preferred one.
  3. Docker Desktop
  4. Node.js

Getting started

Download and install Docker Desktop if you haven't already.

If you are NOT using a Mac (e.g. you are using Windows or Linux) then install Docker Compose.

Download and install Node.js if you haven't already.

Open iTerm2 (or your preferred terminal.)

Clone the repo:

git clone git@github.com:PolyglotDevsLondon/sharespots.git

Change directory into the sharespots directory:

cd sharespots

Quick setup using scripts

Run the this command to set up the project

npm run bootstrap

Then run this command to launch the back-end

npm run dev:docker

Open a new iTerm2 terminal tab by pressing ⌘T (or open an additional terminal window using your preferred terminal.)

Run this command to launch the front-end:

npm run dev

If this worked then you do not need to do manual setup.

If this didn't work look at the troubleshooting section.

(You may, or may not, need to [add opencage api add opencage api key - @TODO test this and update instructions.)

If it still isn't working try the longer manual setup below.

Longer manual setup

Build the docker container (included is django, postgres, pgadmin and jupyter notebook run from django_extensions):

docker-compose -f local.yml build

Launch the docker container:

docker-compose -f local.yml up

Open project in your web browser at:

http://0.0.0.0:8000/

You should now see the Sharespots website (but no venue data will show yet.)

Open a new iTerm2 terminal tab by pressing ⌘T (or open an additional terminal window using your preferred terminal.)

Change to your sharespots directory:

cd [your/sharespot/directory]

Load seed data:

docker-compose -f local.yml run django python manage.py loaddata seed_data.json

Set up a super user for django admin:

docker-compose -f local.yml run django python manage.py createsuperuser

Build everything frontend related with:

npm i && npm run build

Reload your project in your web browser at

http://0.0.0.0:8000/

You should now see the Sharespots website with venues displaying.

(Optional) Open another browser tab/window and login using the superuser account you created in the django admin panel at http://0.0.0.0:8000/admin

Continuously monitor front end changes

npm run dev

Troubleshooting

Rebuild your docker container

If the project doesn't work after pulling the latest changes by doing a git pull, you may need to rebuild to include recently added python modules:

docker-compose -f local.yml build

Add opencage api key

Create an OpenCage API key

And add your OpenCage API key to sharespots/.env/.local/.django e.g.:

# General
# ------------------------------------------------------------------------------
USE_DOCKER=yes
IPYTHONDIR=/app/.ipython


SECRET_KEY=[secret key]
OPENCAGE_API_KEY=[opencage_api_key]
DJANGO_DEBUG=True
ALLOWED_HOSTS=['*']

Useful Database commands

Make migrations

docker-compose -f local.yml run django python manage.py makemigrations

Load data from seed file

docker-compose -f local.yml run django python manage.py dumpdata core.venue > core/fixtures/seed_data.json

Dump data to seed file

To export the Sharespots data from a database to a file:

docker-compose -f local.yml run django python manage.py dumpdata core.venue > core/fixtures/seed_data.json

Then remove auth data at the top to leave just core models.

Useful Front End commands

Install front end dependencies

To install third party libraries:

npm i

Build front-end once

To build everything frontend related run npm run build

This will build the front-end files (e.g. css styling files) once.

Build front-end continuously

When developing continuously monitor front-end files and rebuild whenever files changed:

npm run dev

Useful Heroku commands

Command to create a superuser in staging:

heroku run python manage.py createsuperuser --app sharespots-app

Command to create a superuser in staging production:

heroku run python manage.py createsuperuser --app sharespots-prod

Team

Current

Previously contributed

About

Sharespots - find co-working friendly cafes in London

http://sharespots.co.uk


Languages

Language:Python 46.0%Language:SCSS 20.9%Language:HTML 19.6%Language:Shell 8.5%Language:JavaScript 2.7%Language:Dockerfile 2.3%