Apartment application service
-
Copy the contents of .env.example to .env and modify it if needed.
-
Run docker-compose up
The project is now running at localhost:8081
Prerequisites:
- PostgreSQL 12
- Python 3.8
- Run
pip install -r requirements.txt - Run
pip install -r requirements-dev.txt(development requirements)
To setup a database compatible with default database settings:
Create user and database
sudo -u postgres createuser -P -R -S apartment-application # use password `apartment-application`
sudo -u postgres createdb -O apartment-application apartment-application
Allow user to create test database
sudo -u postgres psql -c 'ALTER USER "apartment-application" CREATEDB;'
Some model fields are encrypted using pgcrypto, which requires a PGP keypair.
For instructions on how to generate the keys, see the
pgcrypto documentation:
Use the PostgreSQL preferred key type ("DSA and Elgamal") and at least 2048 bits as the key size.
To convert the multi-line PEM key into a single line (for .env), you can use this snippet:
cat your-key-file | awk '{print}' ORS='\\n'
For local development, you can use the example keys in .env.example.
Do not use these example keys in production!
- Create
.envfile:touch .env - Set the
DEBUGenvironment variable to1. - Run
python manage.py migrate - Run
python manage.py runserver 0:8081
The project is now running at localhost:8081
-
Install
pip-tools:pip install pip-tools
-
Add new packages to
requirements.inorrequirements-dev.in -
Update
.txtfile for the changed requirements file:pip-compile requirements.inpip-compile requirements-dev.in
-
If you want to update dependencies to their newest versions, run:
pip-compile --upgrade requirements.in
-
To install Python requirements run:
pip-sync requirements.txt
This project uses
black,
flake8 and
isort
for code formatting and quality checking. Project follows the basic
black config, without any modifications.
Basic black commands:
- To let
blackdo its magic:black . - To see which files
blackwould change:black --check .
For Django, this project mostly follows the styleguide defined in Django-Styleguide.