OLDP written in Python 3.5 and based on Django web framework, used for processing legal content (court decisions and law text) and providing a RESTful API and Elasticsearch-based search engine. Our documentation is available here.
Before you can use OLDP, you’ll need to get it installed. For a more detailed guide on how to get started with OLDP have a look at: Getting started
Before anything else you will need to install the application dependencies.
- Python 3.x with pip (virtualenv or conda recommended)
- Node JS 8.12.x with npm for building JS dependencies
- Database (MySQL, SQLite, ...): All database engines that support Django's DB API should work. MySQL is recommended.
- Elasticsearch 5.4.x: Our search engine backend. Other systems supported by haystack should also work.
- Redis 4.x: Caching engine
- gcc Required to compile some Python libs
- python-mysqldb, libmysqlclient-dev if you choose MySQL as database
- gettext for Django locales with msguniq
- pandoc convert docbook to HTML (import GG)
- GDAL: Geospatial libraries used by the haystack search module (see here).
# Create virtualenv
virtualenv -p python3 env
source env/bin/activate
# Install dependencies
apt-get install -y $(cat apt-requirements.txt)
pip install -r requirements.txt
npm install
The first time you run OLDP, you will need to initialize the database with its default blank values. If you want to run OLDP in production mode, you also need to prepare static files and localization.
# Prepare assets (JS, CSS, images, fonts, ...)
npm run-script build
# Prepare database
./manage.py migrate
# Localization (German and English, needed for production)
./manage.py compilemessages --l de --l en
# Prepare static files (needed for production)
./manage.py collectstatic --no-input
Run the following command to start the web app at https://localhost:8000/.
./manage.py runserver 8000
The manage the app settings we rely on django-configurations.
Pre-configured settings can be used by setting the DJANGO_CONFIGURATION
environment variable to either Prod
, Dev
or Test
.
You can as well override specific settings from oldp/settings.py
with environment variables:
Variable name | Default value | Comment |
---|---|---|
DATABASE_URL |
mysql:https://oldp:[email protected]/oldp |
Path to database (usually mysql or sqlite) |
DJANGO_CONFIGURATION |
Prod |
Dev , Prod or Test |
DJANGO_SECRET_KEY |
None |
Set this in production mode |
DJANGO_ELASTICSEARCH_URL |
https://localhost:9200/ |
Elasticsearch settings (scheme, host, port) |
DJANGO_ELASTICSEARCH_INDEX |
oldp |
Elasticsearch index name |
DJANGO_DEBUG |
True |
Enable to show debugging messages and errors |
DJANGO_ADMINS |
Admin,[email protected] |
Format: Foo,[email protected];Bar,[email protected] |
DJANGO_ALLOWED_HOSTS |
None |
Format: foo.com,bar.net |
DJANGO_LANGUAGES_DOMAINS |
Format: {'de.foo.com':'de','fr.foo.com':'fr'} |
|
DJANGO_DEFAULT_FROM_EMAIL |
[email protected] |
Emails are sent from this address |
DJANGO_EMAIL_HOST |
localhost |
SMTP server |
DJANGO_EMAIL_HOST_USER |
SMTP user | |
DJANGO_EMAIL_HOST_PASSWORD |
SMTP password | |
DJANGO_EMAIL_USE_TLS |
False |
enable TLS |
DJANGO_EMAIL_PORT |
25 |
SMTP port |
DJANGO_FEEDBACK_EMAIL |
[email protected] |
Messages from feedback widget are sent to this address. |
DJANGO_TIME_ZONE |
UTC |
Time zone |
DJANGO_TEST_WITH_ES |
False |
Run tests that require Elasticsearch |
DJANGO_TEST_WITH_WEB |
False |
Run tests that require web access |
DJANGO_LOG_FILE |
oldp.log |
Name of log file (in logs directory) |
Please use our GitHub issues to report bugs, request feature or simply leave some feedback.
To contact Open Legal Data Platform, see here:
https://de.openlegaldata.io/contact/
OLDP is licensed under the MIT License.