mein.berlin is a participation platform for the city of Berlin, Germany. It is based on adhocracy 4.
- Node.js (+ npm)
- Python 3.x (+ venv + pip)
- libmagic
- libjpeg
- libpq (only if PostgreSQL is used)
- GDAL
- SpatiaLite with JSON1 enabled (only if SpatiaLite is used for local development)
- Redis (required in production, optional for development)
Note: If you are on macOS, you need GNU sed installed for the following steps to work:
brew install gnu-sed
sudo apt update && sudo apt install -y libsqlite3-mod-spatialite
brew update
brew install spatialite-tools
brew install gdal
For GeoDjango to be able to find the SpatiaLite library, add the following to your local.py:
SPATIALITE_LIBRARY_PATH = "/usr/local/lib/mod_spatialite.dylib"
If you are using pyenv, you need to create your venv with the following command:
PYTHON_CONFIGURE_OPTS="--enable-loadable-sqlite-extensions" pyenv install 3.12.9 (with your version)
git clone https://github.com/liqd/a4-meinberlin.git
cd a4-meinberlin
make install
make fixtures
make watch
If you need to test with PostgreSQL instead of SpatiaLite, run:
make postgres-create
To start the test server with PostgreSQL:
export DATABASE=postgresql
make postgres-start
make watch
To remove the Python virtual environment and npm modules:
make clean
If your virtual environment is located outside the project, uninstall Python packages manually:
pip uninstall -r requirements/dev.txt
If you need to do testing with a proper celery setup.
For celery to register and run tasks you need to make sure that:
- the redis server is running
- the celery config parameter "always eager" is disabled (add
CELERY_TASK_ALWAYS_EAGER = False
to yourlocal.py
)
To start a celery worker in the foreground, run:
make celery-worker-start
Stop celery with ctr+C
To inspect all registered tasks, list the running worker nodes, run:
make celery-worker-status
To send a dummy task to the queue and report the result, run:
make celery-worker-dummy-task
See more info about Celery in the docs
If you need to do testing with periodical task working.
For celery to run scheduled tasks you need to make sure that:
- the redis server is running
- the celery worker is running (see previous step)
To start celery beat in the foreground, run:
make celery-beat
Stop celery beat with ctr+C
To add scheduled tasks (same for all environments) check the docs
In case of settings.TIME_ZONE change, tasks need to be synced with the new time. See HOWTO
- currently all js and css incl fontawesome files are downloaded due to difficulties serving files and slowing development
- img and font resouce paths within the berlin css have been updated to include the local version
- Until versioning of libraries implemented prefered solution would be to have js downloaded once per day and cached, css should only be updated before release due to issues of breaking changes not being versioned or announced.