A simple calendar for tracking OpenStreetMap-related activities.
- Less, but better.
- Work hard and be nice to people.
Please look at OpenStreetMap Calendar Documentation for information about integration and API.
This is a Django application, it uses poetry for managing dependencies. Please look at their documentation for installation instructions.
We support Python ≥ 3.8 and PostgreSQL ≥ 10.
You need a running PostgreSQL database. There are two options: Running it locally or using Docker.
Create a PostgreSQL user called osmcal
and a database osmcal
with the owner set to osmcal
. E.g.
CREATE ROLE osmcal WITH LOGIN ENCRYPTED PASSWORD 'postgres';
CREATE DATABASE osmcal OWNER osmcal;
CREATE EXTENSION postgis;
Make sure you have following line in your pg_hba.conf, so osmcal need a password to log in:
local all all trust
Alternatively, you can set your DB password using the POSTGRES_PASSWORD
environment variable, c.f. the following section on Docker.
docker run -e POSTGRES_DB='osmcal' -e POSTGRES_USER='osmcal' -e POSTGRES_PASSWORD='postgres' --name osmcaldb postgis/postgis
Note: You can use docker start osmcaldb
and docker stop osmcaldb
after first run of the command above.
When using database in docker with the command above, the database host is:
export OSMCAL_PG_HOST=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' osmcaldb)
and database password is:
export OSMCAL_PG_PASSWORD='postgres'
Use poetry to create a virtual environment. Then, install the dependencies:
cd openstreetmap-calendar
poetry install
poetry run ./manage.py test
In order to facilitate testing, you can use a fake login locally without having to setup OAuth first. To do this, scroll down to the footer. In debug mode, there is a link called "Mock login" which will instantly log you in as a normal user.
To prepare for application launch run the database migrations:
poetry run ./manage.py migrate
and then the local server:
poetry run ./manage.py runserver
If you need test data, you can load some using:
poetry run ./manage.py loaddata osmcal/fixtures/demo.yaml
The API is described using OpenAPI 3, the schema is located in /api/schema/
. The currently live version is visible here.
If want to test the OAuth flow, you need to create an OAuth app first:
- Go to osm.org -> My Settings -> oauth settings -> bottom of the page (My Client Applications) -> Register your application.
- Fill
Name
andMain Application URL
. No restrictions here. - You must fill
Callback URL
withhttp://localhost:8000/oauth/callback
. - Mark
read their user preferences.
- Click
Register
.
When the application is registered on osm.org, set the respective environment variables used for oauth and copy Consumer Key and Consumer Secret:
export OSMCAL_OSM_KEY='...'
export OSMCAL_OSM_SECRET='...'