Skip to content

Latest commit

 

History

History
177 lines (110 loc) · 4.4 KB

INSTALL.rst

File metadata and controls

177 lines (110 loc) · 4.4 KB

Installation

This installation is meant for developers of the "SDG invoervoorziening". If you are looking to install the application to try it out, or to run it in production, please consult the documentation.

The project is developed in Python using the Django framework.

Prerequisites

You need the following libraries and/or programs:

Getting started

Developers can follow the following steps to set up the project on their local development machine.

  1. Navigate to the location where you want to place your project.

  2. Get the code:

    $ git clone git@github.com:maykinmedia/sdg-invoervoorziening.git
    $ cd sdg-invoervoorziening
  3. Install all required libraries.

    $ virtualenv env
    $ source env/bin/activate
    $ pip install -r requirements/dev.txt
  4. Install and build the frontend libraries:

    $ npm ci
    $ npm run build
  5. Activate your virtual environment and create the statics and database:

    $ python src/manage.py collectstatic --link
    $ python src/manage.py migrate
  6. Create a superuser to access the management interface:

    $ python src/manage.py createsuperuser
  7. You can now run your installation and point your browser to the address given by this command:

    $ python src/manage.py runserver
  8. Create a .env file with database settings. See dotenv.example for an example.

    $ cp dotenv.example .env

Note: If you are making local, machine specific, changes, add them to src/sdg/conf/local.py. You can base this file on the example file included in the same directory.

Note: You can run watch-tasks to compile Sass to CSS and ECMA to JS using npm run watch.

Update installation

When updating an existing installation:

  1. Activate the virtual environment:

    $ cd sdg-invoervoorziening
    $ source env/bin/activate
  2. Update the code and libraries:

    $ git pull
    $ pip install -r requirements/dev.txt
    $ npm install
    $ npm run build
  3. Update the statics and database:

    $ python src/manage.py collectstatic --link
    $ python src/manage.py migrate

Testsuite

To run the test suite:

$ python src/manage.py test sdg

Configuration via environment variables

A number of common settings/configurations can be modified by setting environment variables. You can persist these in your local.py settings file or as part of the (post)activate of your virtualenv.

  • SECRET_KEY: the secret key to use. A default is set in dev.py
  • DB_NAME: name of the database for the project. Defaults to sdg.
  • DB_USER: username to connect to the database with. Defaults to sdg.
  • DB_PASSWORD: password to use to connect to the database. Defaults to sdg.
  • DB_HOST: database host. Defaults to localhost
  • DB_PORT: database port. Defaults to 5432.
  • SENTRY_DSN: the DSN of the project in Sentry. If set, enabled Sentry SDK as logger and will send errors/logging to Sentry. If unset, Sentry SDK will be disabled.

Settings

All settings for the project can be found in src/sdg/conf. The file local.py overwrites settings from the base configuration.

Commands

Commands can be executed using:

$ python src/manage.py <command>

There are no specific commands for the project. See Django framework commands for all default commands, or type python src/manage.py --help.