This tool is the Django-based implementation of the already existing Offgridplanner tool, which originated from the PeopleSun project and was originally written using FastAPI.
The open-source tool originated from the PeopleSuN project and serves the planning of off-grid systems in Nigeria. The tool aims to perform a spatial optimization of the distribution grid as well as the design of the energy converters and energy storage.
The features of the tool are listed below:
- Automatic Identification of Buildings from OpenStreetMap: Utilizes OpenStreetMap data to automatically identify building locations.
- Spatial Optimization of the Distribution Grid: Enhances the efficiency of the distribution grid through spatial optimization techniques.
- Design Optimization of Generation Systems: Optimizes the design of PV systems, battery systems, inverters, and diesel-engines.
- Automatic Identification for Individual Solar Home Systems: Identifies buildings that are more suitably served by individual solar home systems.
The application is composed of the following services:
django
: the application running behind Gunicorn.postgres
: PostgreSQL database with the application’s data.redis
: Redis instance for caching.traefik
: Traefik reverse proxy with HTTPS on by default.celeryworker
: Dunning a Celery worker process.flower
: To manage and monitor the celery task queue.
The environment variables for Docker are defined within the .envs
folder. To build the container, open a terminal at
the project root and run the following for local development:
docker compose -f docker-compose.local.yml up -d --build
If you want to emulate production environment use docker-compose.production.yml
instead. For more information please
refer to the cookiecutter-django documentation.
Make sure you have the following installed:
- Python 3.12
- PostgreSQL
- Redis (you may have to install the Windows Subsystem for Linux (WSL) if developing on Windows)
- Mailpit
Then proceed to the next steps.
- Create a virtual environment using
python=3.12
- Activate your virtual environment
- Create a new postgreSQL database
- Define your environment variables (you can create a
.env
file at the root level, it will be read by Django)
POSTGRES_ENGINE=django.db.backends.postgresql
POSTGRES_DB=<your db name>
POSTGRES_USER=<your username>
POSTGRES_PASSWORD=<your password>
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
USE_DOCKER=(yes|no)
DJANGO_DEBUG=(True|False)
- Execute the local_setup.sh file (
sh local_setup.sh
/. local_setup.sh
) - Start the redis service with
redis-server
(you will need to use a WSL terminal if developing on Windows) - Start the celery worker in a separate terminal with
celery -A config.celery_app worker -l info
(you may have to specify--pool=solo
if developing on Windows) - Start your local mail server in a new terminal with
mailpit
. To view the UI, access http://127.0.0.1:8025/ - Start the local development server in a new terminal with
python manage.py runserver
:)
For more information on developing locally, refer to the cookiecutter-django documentation.
For more information about Django settings.