Skip to content

lorand-ibm/apartment-application-service

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

557 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apartment-application-service

Apartment application service

Development with Docker

  1. Copy the contents of .env.example to .env and modify it if needed.

  2. Run docker-compose up

The project is now running at localhost:8081

Development without Docker

Prerequisites:

  • PostgreSQL 12
  • Python 3.8

Installing Python requirements

  • Run pip install -r requirements.txt
  • Run pip install -r requirements-dev.txt (development requirements)

Database

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;'

Database encryption

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!

Daily running

  • Create .env file: touch .env
  • Set the DEBUG environment variable to 1.
  • Run python manage.py migrate
  • Run python manage.py runserver 0:8081

The project is now running at localhost:8081

Keeping Python requirements up to date

  1. Install pip-tools:

    • pip install pip-tools
  2. Add new packages to requirements.in or requirements-dev.in

  3. Update .txt file for the changed requirements file:

    • pip-compile requirements.in
    • pip-compile requirements-dev.in
  4. If you want to update dependencies to their newest versions, run:

    • pip-compile --upgrade requirements.in
  5. To install Python requirements run:

    • pip-sync requirements.txt

Code format

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 black do its magic: black .
  • To see which files black would change: black --check .

For Django, this project mostly follows the styleguide defined in Django-Styleguide.

About

Apartment application service

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Packages

 
 
 

Contributors

Languages

  • Python 98.5%
  • Shell 1.2%
  • Dockerfile 0.3%