Welcome to the SameTimeSamePlace Backend project! Our goal is to bring people together who want to experience new things and get to know new people at the same time.
This project uses Django and PostgreSQL. Make sure you have a PostgreSQL-server running.
To run the project, clone the repo and create a .env file in the root folder containing:
DB_HOST=<address of your postgresql server>
DB_NAME=<name of the database you want to use>
DB_USER=<postgres-username>
DB_PASSWORD=<postgres-user-password>
DB_PORT=<port to connect to your server, default is 5432>
DB_SECRET=<secret token>
RAPID_API=<your geodb api token>
To obtain the RAPID_API key, you can subscribe to the GeoDB Cities API on RapidAPI. Leaving the value empty will still allow the project to work, but the city information of newly created timeplaces won't be automatically filled.
To create a new secret token, you can import secrets in python and use secrets.token_urlsafe(<bytes>). It's common to precede django-insecure for dev environments.
Create a virtual python environment with the tool of your choice, for example venv:
python -m venv .venvAnd activate it with
source .venv/bin/activateNext, install the required modules with pip:
pip install -r requirements/dev.txtFor convenience, the Makefile includes several targets - for this case, you can use
make dev-installto install the dependencies.
To populate your database with the required tables and relations, run
make dev-makemigrationsfollowed by
dev-migrateTo create an admin user, you can use
python manage.py createsuperuser --settings=config.settings.devYou should now be able to start the django server with
make dev-startand access the site on http://127.0.0.1:8000/.
The Swagger API documentation is available on http://127.0.0.1:8000/api/v1/swagger