Skip to content
This repository has been archived by the owner on Jun 12, 2021. It is now read-only.

hospitalCo/hopitalco-backend

Repository files navigation

hopitalco-backend [ARCHIVED]

This project is archived, you might like to check how we used cookiecutter and how we set up the dev container.

Build Status Built with

Providing a simple, focussed marketplace for healthcare.. Check out the project's documentation.

Getting started

You'll need Docker and ideally a recent python installation. Choose your poison 🐍

A kind request

After you choose one of the two recommended ways to set up, we suggest that you mount the pre-commit hooks:

pre-commit install

Be a bit patient, this downloads some python packages -- trust us, this will supercharge ⚡ ⚡ your development experience!

(1) Local development with Postgres in Docker (recommended)

Like most people, you'd like to keep the code on your machine and maybe just the DB inside docker. That works best.

Set up python env

  1. Set up a vitual environment using any manager of your choice (or simply python -m venv .pyenv) -- and activate it.
  2. Install the deps:
    pip install -r requirements.txt
  3. Copy .env.example to .env (and ideally don't edit it).

Up the services

docker-compose up -d postgres documentation

# to see logs/stdout attach a shell
docker logs -f <postgres-container-name> # or <documentation-container-name>

This will launch only the Postgres and documentation services inside docker.

Edit and hot-reload

The django app will load your .env to pick the Postgres configuration. Run the app:

python manage.py runserver

or generate and run migrations as usual 🎉

python manage.py migrate

Inspecting the DB

Want to inspect the shell using psql?

psql -U postgres -d development -h localhost -p 8002

(2) Local development on your machine (no Docker, recommended)

  1. Set up a vitual environment using any manager of your choice (or simply python -m venv .pyenv).
  2. pip install -r requirements.txt
  3. Install Postgres 12 on your machine (lower versions may work absolutely fine and are untested).
  4. Copy the .env.example to .env and edit it to suit your installation of Postgres.
  5. Do your thing 🎉

(3) Local Development using Docker (not recommended)

You can do most development without setting up any python packages/environments on your local machine -- keeping the code and the DB inside docker.

Up the services

docker-compose up -d

# to see logs/stdout attach a shell
docker logs -f web # or <postgres-container-name> or <documentation-container-name>

Edit and hot-reload

By default the docker container will watch for local changes you make using your editor and reload the server (typical django).

Cons

The only problem is running migrations, you'll have to resort to

docker-compose run --rm web "python migrate.py migrate"

About

Django + DRF backend

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •