Skip to content

armaaar/lost_children_backend

Repository files navigation

lost_children_backend

The frontend for the lost children project. This project uses django.

Prerequisites

First, make sure you have Python installed. Python 3 is recommended.

This project uses pipenv to manage packages and versions. Refer to their installation section to know how to install it.

Setup

  1. Create .env file in the project root with the required environment variables. See .env.example for list of environment variables.

  2. Activate the virtual environment using pipenv shell

  3. Install all packages: pipenv install

Useful scripts

pipenv commands

  • Activate virtual environment:
pipenv shell
  • Install all pacakges for this project:
pipenv install
  • install a package:
# Install a normal dependancy:
pipenv install mypackage

# Install a dev dependency:
pipenv install mypackage --dev
  • Create requirements.txt if needed:
pipenv lock -r > requirements.txt

django commands

Don't forget to activate the virtual environment first. For full list of commands, refer to manage.py documentation

  • Run the development server:
python manage.py runserver
  • Create a new app (module):
python manage.py startapp module_name
  • Create a migration:
python manage.py makemigrations module_name
  • Migrate database:
python manage.py migrate
  • Run cron jobs:
python manage.py runcrons
  • Create a superuser for admin interface:
python manage.py createsuperuser
  • Check app for errors:
python manage.py check

Other useful commands

  • To lint your code:
find . -type f -name "*.py" -not -path "**/migrations/*" | xargs pylint

Troubleshooting

Most of the problems you might face will mostly be because you are not using the right virual environment or that you didn't install the required packages. Make sure your IDE using the correct interpretter from your venv. You can get the path to the venv interpretter using:

pipenv --py

Setting up cron jobs

This project uses django-cron to setup cron jobs. For more info about how to setup a cron job and what is the available commands, refer to their installation doc

TODO list

  • Add tests
  • Validate request expected attributes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published