Sharespots is a simple Django app that displays a curated list of cafes/co-working spaces to meetup and work in London.
- Backend: Python & Django
- Front-end: SASS/HTML5/JavaScript
- Hosting: Heroku
- Storage: AWS S3
We use pytest for our tests
To run Pytest please run this command npm run django-tests
- Terminal: iTerm2 (MacOSX), Terminator (Linux) or use your preferred one.
- Text Editor: Sublime Text or your preferred one.
- Docker Desktop
- Node.js
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
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.
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:
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
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
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
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=['*']
docker-compose -f local.yml run django python manage.py makemigrations
docker-compose -f local.yml run django python manage.py dumpdata core.venue > core/fixtures/seed_data.json
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.
To install third party libraries:
npm i
To build everything frontend related run npm run build
This will build the front-end files (e.g. css styling files) once.
When developing continuously monitor front-end files and rebuild whenever files changed:
npm run dev
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