sirodoht / srdce

Homey cybernetic platform.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

srdce

Homey cybernetic platform.

Development

This is a Django codebase. Check out the Django docs for general technical documentation.

Structure

The Django project is srdce. There is one Django app, main Django app, with all business logic.

Dependencies

Using venv:

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
pip install -r requirements_dev.txt

This project also uses pip-tools for dependencies management.

Environment variables

You need to create a new file named .envrc in the root of this project once you cloned it.

.envrc should contain the following env variables:

SECRET_KEY="thisisthesecretkey"
DATABASE_URL="postgres://srdce@127.0.0.1:5432/srdce"
EMAIL_HOST_USER="smtp_user"
EMAIL_HOST_PASSWORD="smtp_password"

When on production use also include:

NODEBUG=1

Database

This project uses PostgreSQL. See above on how to configure it using the .envrc file.

After creating your local database, you need to create the schema and apply the migrations:

python manage.py migrate

Serve

To run the Django development server:

python manage.py runserver

Testing

python manage.py test

For coverage, run:

coverage run --source='.' --omit 'venv/*' manage.py test
coverage report -m

Code linting & formatting

The following tools are used:

  • black for code formatting.
  • isort for imports order consistency.
  • flake8 for code linting.
make format
make lint

Deployment

Deployment is configured using the production-grade uwsgi server.

uwsgi --ini=uwsgi.ini -H venv/

You also need to populate your shell environment:

export SECRET_KEY="thisisthesecretkey"
export DATABASE_URL="postgres://username:password@localhost:5432/db_name"
export EMAIL_HOST_USER="smtp_user"
export EMAIL_HOST_PASSWORD="smtp_password"

Management

In addition to the standard Django management commands, there is also:

python manage.py reset_dev_database

Which fills some sample data for a development database.

License

This software is licensed under the MIT license. For more information, read the LICENSE file.

About

Homey cybernetic platform.

License:MIT License


Languages

Language:CSS 41.6%Language:SCSS 34.0%Language:JavaScript 9.3%Language:Python 7.7%Language:HTML 7.2%Language:Makefile 0.1%Language:Nix 0.0%