Custom setting file

Geotrek basic configuration is currently restricted to values present in etc/settings.ini.

However, it is possible to write a custom Django setting file to override all default values from geotrek/settings/ file.

  • Create your a file in geotrek/settings/ with the following content :
# coding: utf8

from .prod import *

# My custom value
  • Add this etc/settings.ini to specify the newly created setting :
settings = settings.custom
  • As for any change in etc/settings.ini, re-run make env_standalone deploy. To apply changes in geotrek/settings/, you can just restart the application with sudo supervisorctl restart all.

Disable modules and components

In order to disable a full set of features, in the custom settings file, add the following code:

# Disable infrastructure and maintenance

In order to remove notion of trails:


In order to remove zoning combo-boxes on list map:

notes:By doing so, some software upgrades may not be as smooth as usual. Never forget to mention this customization if you ask for community support.

Sensitive areas

In order to enable sensitivity module, in the custom settings file, add the following code:

# Enable sensitivity module
INSTALLED_APPS += ('geotrek.sensitivity', )

The following settings are related to sensitive areas:


# Default radius of sensitivity bubbles when not specified for species

# Buffer around treks to intersects sensitive areas


In order to enable diving module, in the custom settings file, add the following code:

# Enable diving module
INSTALLED_APPS += ('geotrek.diving', )

Then run make env_standalone deploy.

You can also insert diving minimal data (default practices, difficulties, levels and group permissions values):

./bin/django loaddata geotrek/diving/fixtures/basic.json
cp geotrek/diving/fixtures/upload/* var/media/upload/

WYSIWYG editor configuration

Text form fields are enhanced using TinyMCE.

Its configuration can be customized using advanced settings (see above paragraph).

For example, in order to control which buttons are to be shown, and which tags are to be kept when cleaning-up, add this bloc :

    'theme_advanced_buttons1': 'bold,italic,forecolor,separator,code',
    'valid_elements': "img,p,a,em/i,strong/b",

This will apply to all text fields.

For more information on configuration entries available, please refer to the official documentation of TinyMCE version 3.

View attachments in the browser

Attached files are downloaded by default by browser, with the following line, files will be opened in the browser :


Change or add WMTS tiles layers (IGN, OSM, Mapbox…)

By default, you have 2 basemaps layers in your Geotrek-admin (OSM and OSM black and white).

You can change or add more basemaps layers.

Specify the tiles URLs this way in your custom Django setting file:

    ('OSM', 'http://{s}{z}/{x}/{y}.png', u'© OpenStreetMap Contributors'),
    ('OpenTopoMap', '{z}/{x}/{y}.png', u'Map data: © OpenStreetMap contributors, SRTM | Map style: © OpenTopoMap (CC-BY-SA)'),

Example with IGN and OSM basemaps :

    ('IGN Scan', '//{z}&TILEROW={y}&TILECOL={x}', u'© IGN Geoportail'),
    ('IGN Scan Express', '//{z}&TILEROW={y}&TILECOL={x}', u'© IGN Geoportail'),
    ('IGN Ortho', '//{z}&TILEROW={y}&TILECOL={x}', u'© IGN Geoportail'),
    ('IGN Cadastre', '//{z}&TILEROW={y}&TILECOL={x}', u'© IGN Geoportail'),
    ('OSM', 'https//{s}{z}/{x}/{y}.png', u'© OpenStreetMap contributors'),
    ('OSM Stamen Terrain', '//{z}/{x}/{y}.jpg', u'© OpenStreetMap contributors / Stamen Design'),
    ('OpenTopoMap', 'https//{z}/{x}/{y}.png', u'Map data: © OpenStreetMap contributors, SRTM | Map style: © OpenTopoMap (CC-BY-SA)')

To use IGN Geoportail WMTS tiles API, you need an API key with subscribing on Choose WebMercator WMTS tiles.

External authent

You can authenticate user against a remote database table or view.

To enable this feature, fill authent_dbname and other fields in etc/settings.ini.

Expected columns in table/view are :

  • username : string (unique)
  • first_name : string
  • last_name : string
  • password : string (simple md5 encoded, or full hashed and salted password)
  • email : string
  • level : integer (1: readonly, 2: redactor, 3: path manager, 4: trekking manager, 6: administrator)
  • structure : string
  • lang : string (language code)

The schema used in authent_tablename must be in the user search_path (ALTER USER $geotrek_db_user SET search_path=public,userschema;)

User management will be disabled from Administration backoffice.

In order to disable remote login, just remove authent_dbname value in settings file, and update instance (see paragraph above).

Geotrek can support many types of users authentication (LDAP, oauth, …), contact us for more details.

Map layers colors and style

All layers colors can be customized from the settings. See Leaflet reference for vectorial layer style.

  • To apply these style changes, re-run sudo supervisorctl restart all.
MAP_STYLES['path'] = {'color': 'red', 'weight': 5}

Or change just one parameter (the opacity for example) :

MAP_STYLES['city']['opacity'] = 0.8

Regarding colors that depend from database content, such as land layers (physical types, work management…) or restricted areas. We use a specific setting that receives a list of colors :

COLORS_POOL['restrictedarea'] = ['#ff00ff', 'red', '#ddddd'...]

See the default values in geotrek/settings/ for the complete list of available styles.

Restart the application for changes to take effect.

External raster layers

It is possible to add overlay tiles layer on maps. For example, it can be useful to:

  • Get the cadastral parcels on top of satellite images
  • Home made layers (with Tilemill or QGisMapserver for example). Like the park center borders, traffic maps, IGN BDTopo® or even the Geotrek paths that are marked as invisible in the database!

In, just add the following lines:

    ('Coeur de parc', 'http://serveur/coeur-parc/{z}/{x}/{y}.png', '© PNF'),

Expected properties

For GeoJSON files, you can provide the following properties :

  • title: string
  • description: string
  • website: string
  • phone: string
  • pictures: list of objects with url and copyright attributes
  • category: object with id and label attributes

Disable darker map backgrounds

Since IGN map backgrounds are very dense and colourful, a dark opacity is applied. In order to disable, change this MapEntity setting :


Override translations

You can override default translation files available in each module (for example those from trekking module available in <geotrek-admin-folder>/geotrek/trekking/locale/fr/LC_MESSAGES/django.po).

Don’t edit these default files, use them to find which words you want to override.

Create the custom translations destination folder:

cd  <geotrek-admin-folder>/geotrek/
mkdir -p locale/en/LC_MESSAGES

Then create a django.po file in this directory. You can do one folder and one django.po file for each language (example <geotrek-admin-folder>/geotrek/locale/fr/LC_MESSAGES/django.po for French translation overriding)

Override the translations that you want in these files.

Example of content for the French translation overriding:

# This file is distributed under the same license as the PACKAGE package.
msgid ""
msgstr ""
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-11-15 15:32+0200\n"
"PO-Revision-Date: 2018-11-15 15:33+0100\n"
"Last-Translator: \n"
"Language-Team: LANGUAGE <>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Project-Id-Verésion: PACKAGE VERSION\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"Project-Id-Version: \n"
"X-Generator: Poedit 1.5.4\n"

msgid "City"
msgstr "Région"

msgid "District"
msgstr "Pays"

Apply changes :

cd <geotrek-admin-folder>
make env_standalone deploy

Override public pdf templates

PDF are generated from html printed, using [Django templating]( Trekkings, touristic contents and events can be exported in pdf files.

  • Treks : geotrek/trekking/templates/trekking/trek_public_pdf.html
  • touristic contents : geotrek/tourism/templates/tourism/touristiccontent_public_pdf.html
  • touristic events : geotrek/tourism/templates/tourism/touristiccontent_public_pdf.html

Overriden templates have to be located in var/media/templates/<appname>, with appname = trekking or tourism. To override trekking pdf for example, copy the file geotrek/trekking/templates/trekking/trek_public_pdf.html to var/media/templates/trekking/trek_public_pdf.html.

These templates derive from base templates, which content is organized in blocks. To override for example the description block of trek pdf, copy and change the {% block description }…{% endblock description %} in your var/media/templates/trekking/trek_public_pdf.html.

It is also possible to use color defined for practice for pictogram by adding in your geotrek/trekking/templates/trekking/trek_public_pdf.html file :

{% block picto_attr %}style="background-color: {{ object.practice.color }};"{% endblock picto_attr %}

CSS can be overriden like html templates : copy them to var/media/templates/trekking/ or var/media/templates/tourism/ folder


The default template may change in the future versions. You will be in charge of porting the modification to your copy.

Test your modifications by exporting a trek or a content to pdf from Geotrek-admin application. To get your modifications available for Rando application, launch the sync_rando command.

Custom font in public document template

In order to use custom fonts in trek PDF, it is necessary to install the font files on the server.

Microsoft fonts like Arial and Verdana can be installed via the package manager

sudo apt-get install ttf-mscorefonts-installer

For specific fonts, copy the .ttf (or .otf) files into the folder /usr/local/share/fonts/custom/ as root, and run the following command


For more information, check out Ubuntu documentation.

Custom colors in public document template

Trek export geometries are translucid red by default. In order to control the apparence of objects in public trek exports, use the following setting :

MAP_STYLES['print']['path'] = {'weight': 3}

See Leaflet reference documentation for detail about layers apparence.

Primary color in PDF templates

You can override PRIMARY_COLOR to change emphase text in PDF export. Beware of contrast, colour is used for text so we advise you to avoid light colour.

Custom logos

You might also need to deploy logo images in the following places :

  • var/media/upload/favicon.png
  • var/media/upload/logo-login.png
  • var/media/upload/logo-header.png

Share services between several Geotrek instances

As explained in the design section, Geotrek relies on several services. They are generic and reusable, and can thus be shared between several instances, in order to save system resources for example.

A simple way to achieve this is to install one instance with everything as usual (standalone), and plug the other instances on its underlying services.


Sharing your postgreSQL server is highly recommended. Create several databases for each of your instances.

Then in etc/settings.ini, adjust the host and dbname sections of each instance.

Capture and conversion

On the standalone server, make sure the services will be available to others. Add the following lines in its settings.ini :

host =

host =

In, point the tiles URL to the shared services (replace SERVER by the one you installed as standalone) :


Shutdown useless services

Now that your instances point the shared server. You can shutdown the useless services on each instance.

Start by stopping everything :

sudo stop geotrek

Before you used to run make env_standalone deploy on every server. Now you will have only one standalone, and on the other ones the Geotrek application only.

To achieve this, you will just have to run the prod environment instead of standalone in the deployment procedure (or when settings are changed) :

make env_prod deploy

Control number of workers and request timeouts

By default, the application runs on 4 processes, and timeouts after 30 seconds.

To control those values, add a section in etc/settings.ini for each running service. See conf/settings-defaults.cfg for an exhaustive list:

workers = 4
timeout = 30

To know how many workers you should set, please refer to gunicorn documentation.