Development Setup
For HELIPORT developement, we suggest creating a dedicated new instance config which can then be used by one developer, or commited to a Git repository and shared. The development setup should consist of the following files and directories:
.
├── pyproject.toml
├── heliport
│ ├── .git
│ │ └── ...
│ └── ...
└── heliport_config
├── __init__.py
├── asgi.py
├── wsgi.py
├── celery.py
├── urls.py
├── settings.py
└── .env
Creating a Virtual Environment
Both the dependencies and the config should be installed into a virtual environment. The example linked above uses Poetry. For instructions on how to use Poetry, please refer to the Poetry documentation.
Alternatively, the venv module shipped with Python can be used. For example:
python -m venv venv
source venv/bin/activate
python -m pip install -e .
Extra packages for development (e.g. pytest and sphinx) can be installed via
dependency groups within the heliport repo:
python -m pip install --group heliport/pyproject.toml:dev --group heliport/pyproject.toml:docs
Running the Development Server
To start the development server, run:
heliport-cli migrate
heliport-cli runserver
To create an admin user, run:
heliport-cli createsuperuser
This user can be used to access the admin interface at /admin/.
Using the Testing Config
The Pytest command is configured to automatically use the testing config provided in
testing/config/.
To execute the tests, run:
pytest heliport
It is also possible to run the development server using the testing config, e.g. when making small changes. To do this, certain environment variables have to be set:
export PYTHONPATH="heliport/testing"
export DJANGO_SETTINGS_MODULE=config.settings
heliport-cli migrate
heliport-cli runserver
Start the Celery Worker
To run background tasks, a Celery worker needs to be running.
Start the Celery worker:
celery -A heliport_config worker
Or run it in the background:
celery -A heliport_config multi start "celery@$HOSTNAME" --logfile=celery.log --pidfile=celery.pid
Note
Make sure you have a Celery Broker installed as described in Prerequisites.
Build the JavaScript Code Bundles
To build the JavaScript code, the necessary libraries need to be installed.
This can be done by running yarnpkg install within the heliport/ directory.
Then, running yarnpkg build will create webpacks of the JavaScript and CSS code.
To start the webpack development server which keeps the webpacks up to date during
development, run yarnpkg dev.
If you don’t want to change any Javascript code, running the build command once will
suffice.
Note
The yarnpkg command refers to the Yarn package manager.
On some systems it might simply be called yarn.