🔥 Wagtail CMS + ReactJS 🔥
Oma.helsinki is a MyData-based user account for city services. It provides user-driven data handling and consent management for City of Helsinki services.
For any type of local development setup the following is recommended:
-
Create local settings:
touch local_settings.py
-
Set
DEBUG = True
-
In order to use some Tunnistamo instance to handle user logins, set proper url and keys in
local_settings.py
:
TUNNISTAMO_BASE_URL = 'http://some.url'
SOCIAL_AUTH_TUNNISTAMO_KEY = 'some key'
SOCIAL_AUTH_TUNNISTAMO_SECRET = 'some secret'
SOCIAL_AUTH_TUNNISTAMO_OIDC_ENDPOINT = TUNNISTAMO_BASE_URL + '/openid'
Get these from someone involved in the project.
The project will also work without them, but the only way to login would be through Wagtail admin interface.
-
Start docker containers:
docker-compose up
-
When you run your containers for the first time, apply Django migrations:
docker exec -it omahelsinki python manage.py migrate
- answer yes to all questions
Now your project is live at localhost:8000
You can load some dummy data for wagtail if you want:
curl "https://omahelsinki.test.hel.ninja/media/omahelsinki-datadump.json" > omahelsinki-datadump.json
docker exec omahelsinki python manage.py loaddata omahelsinki-datadump.json
To log into django container do docker exec -it omahelsinki bash
There is a compiler container for the react app, so any changes to react JS files will get built automatically and cause the current Django page to reload.
- PostgreSQL
- Python >3
- Virtualenv
- gettext (to compile translations)
- Create Virtualenv env:
virtualenv -p python3 django
- Navigate to env directory, activate env:
cd django && source bin/activate
- Clone omahelsinki to env dir:
git clone https://github.com/City-of-Helsinki/omahelsinki.git
- Go inside oma dir
cd omahelsinki
- Install dependencies
pip install -r requirements.txt
- Install dev-dependencies
pip install -r requirements-dev.txt
yarn install
yarn build
- Check if db service is running
- Create database
python manage.py migrate
python manage.py compilemessages
python manage.py createsuperuser
python manage.py runserver
Now your project is live at localhost:8000
You can load some test content for the Wagtail part:
curl "https://omahelsinki.test.hel.ninja/media/omahelsinki-datadump.json" > omahelsinki-datadump.json
python manage.py loaddata omahelsinki-datadump.json
In order to log in into the profile through Omahelsinki UI you either:
a). Have proper keys to test instance of Tunnisamo mentioned in part 3 of general prerequisites
or
b). Have set up your own local instances of:
If you are running all of these services locally through Docker, you need to make sure that they can communicate with each other. Here is a guide that will help you to set them up properly:
If you are not using Docker (you run all of the projects directly on your machine with some virtual environment for python dependencies), you can skip this part.
Here is a guide that will help you configure all of the clients, scopes and APIs in you local Tunnistamo:
It's recommended to have format on save in your editor to automatically comply with prettier/eslint rules. For example with VSCode you should have the following in your Workspace Settings:
{
"editor.formatOnSave": true
}
You can also manually prettify everything with (from project root folder)
yarn prettier "assets/**/*.js" --write
Also to verify everything is OK, use
yarn lint
- Landing page: localhost:8000
- Wagtail admin: /admin
- Profile React UI: /mydata
- Onboarding: /welcome
This project is licensed under the MIT License