Skip to content

praekeltfoundation/healthcheck

Repository files navigation

healthcheck

Installation

For an efficient project setup, it is recommended you follow these steps:

  1. Create and activate a virtual environment.
  2. Install dependencies from setup.py, requirements.txt, and requirements-dev.txt.
  3. Confirm PostgreSQL installation and activation.

To get your Docker container up and running, run the following line of code in the same directory as the docker files in your repo.

$ docker-compose up --build

You also want to create and configure a .env file, to ensure that your instance works as intended.

Example .env config:

DJANGO_SETTINGS_MODULE=healthcheck.settings.dev
SECRET_KEY=secret-key
DATABASE_URL=psql://user:password@db:5432/table
ALLOWED_HOSTS=*
TURN_API_KEY=turn-api-key
CELERY_BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
CELERY_ACCEPT_CONTENT=application/json
CELERY_TASK_SERIALIZER=json
CELERY_RESULT_SERIALIZER=json

PostgreSQL is used by default in docker container named db. It's best to not change that. You can change the following enviromental variables in docker-compose.yml:

db:
    environment: 
        - POSTGRES_PASSWORD=django
        - POSTGRES_USER=django
        - POSTGRES_DB=healthcheck

You also need to include those in DATABASE_URL. You should re-build your local container after adding new dependencies.

After building, create admin account

$ python manage.py createsuperuser

You can use provided credentials to log into admin panel.

Running

$ docker-compose up

You can access shell by either installing all dependencies from setup.py, requirements.txt and requirements-dev.txt in your venv and running

$ python manage.py shell

or by connecting to docker container shell using following command:

$ docker-compose run django bash

Submitting a PR

Before submitting a PR make sure you have ran tests

$ pip install -e .
$ python manage.py test

and formatted your code. To do so, run:

$ isort **/*.py
$ black .
$ flake8 .

flake8 will point out any errors but it is not used during PR testing. It is best to keep the least amount of these errors. It is strongly advised to wrap any of requests your test make with responses library.

Load fixtures

$ python loaddata <fixturename>

where <fixturename> is the name of the fixture file you’ve created. Each time you run loaddata, the data will be read from the fixture and re-loaded into the database. Note this means that if you change one of the rows created by a fixture and then run loaddata again, you’ll wipe out any changes you’ve made.

or

$ ./manage.py loaddata clinicfinder/fixtures/*.json

To load all fixtures at once

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages