Skip to content

mathooko/backend

Repository files navigation

django-template

Virtual environment setup

Create virtual environment

python3 -m venv venv

Activate virtual environment

source venv/bin/activate

Environment variables setup

Create a .env file in the root directory and add the following variables in the .env.example file.

Note

The default database is sqlite3 on local environment. If you want to use postgresql(or any other), then make sure you set the environment variables in the .env for the database as shown in the .env.example file so that the DB_IS_AVAIL variable in config.settings.local is set to True.

Install dependencies

pip install -r requirements/local.txt

Run migrations

If you don't set the DB variables in the .env file, then the default database is sqlite3.

python manage.py migrate

Run local server

python manage.py runserver

Run tests

This covers linting with flake8, unit tests with pytest and coverage report.

tox

Run production server

Install dependencies

pip install -r requirements/production.txt

Other Requirements

Note

Make sure you set the environment variables in the .env for the database as shown in the .env.example file so that the DATBASE_URL, AWS S3 variables & SENTRY variables are set.

python manage.py runserver --settings=config.settings.prod

Docker setup

Note

The default port for postgresql is 5432 but in the Docker setup, the port is 5435. So, make sure you change the port number in the .env file when using Docker.

Build image and run container

docker-compose up --build

List images

docker images

List containers

docker ps

About

This is a backend for washifyy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages