Configuration¶
Basic configuration update¶
To update basic configuration (server name, database connection, languages, or set workers number or timeout), run:
sudo dpkg-reconfigure geotrek-admin
docker compose run --rm web update.sh
The basic configuration is stored in /opt/geotrek-admin/var/conf/env
file, not to be changed manually.
This file also contains the PostgreSQL authentification details, if you need to access your Geotrek-admin database.
Custom setting file¶
Geotrek-admin advanced configuration is done in /opt/geotrek-admin/var/conf/custom.py
file.
The list of all overridable setting and default values can be found at : geotrek/settings/base.py.
After any change in custom.py
, run:
sudo service geotrek restart
docker compose down && up -d
Sometimes you also have to run:
sudo dpkg-reconfigure geotrek-admin
docker compose run --rm web update.sh
Note
Don’t override the os.getenv()
settings as they are managed with Basic configuration.
NGINX configuration¶
NGINX configuration is controlled by Geotrek-admin and will be erased at each upgrade.
Do not modify /etc/nginx/sites-available/geotrek.conf
or /etc/nginx/sites-enable/geotrek.conf
.
Modify /opt/geotrek-admin/var/conf/nginx.conf.in
instead. To update nginx.conf
, then run:
sudo dpkg-reconfigure geotrek-admin
docker compose run --rm web update.sh
Activate SSL / HTTPS¶
To activate https, you need firstly to change custom.py
and add:
SESSION_COOKIE_SECURE = True
CSRF_COOKIE_SECURE = True
After this, edit nginx.conf.in
to add your certificate.
If you generate it with letsencrypt :
You can use certbot to add the certificate in your configuration.
But you will have to move the configuration automatically added into nginx.conf
, to the file nginx.conf.in
in /opt/geotrek-admin/var/conf/
directory.
You have to move the configuration to the file nginx.conf.in
because nginx.conf
is automatically changed during command dpkg-reconfigure geotrek-admin
.
Warning
You need to replace the $
from Certbot with ${DOLLAR}
everywhere in the nginx.conf.in
file, then run the command sudo dpkg-reconfigure geotrek-admin
to regenerate the file.
Mandatory settings¶
Spatial reference identifier¶
SRID = 2154
Spatial reference identifier of your database. Default 2154 is RGF93 / Lambert-93 - France
It should not be change after any creation of geometries.
Choose wisely with epsg.io for example
Default Structure¶
DEFAULT_STRUCTURE_NAME = "GEOTEAM"
Name for your default structure.
This one can be changed, except it’s tricky.
First change the name in the admin (authent/structure),
Stop your instance admin.
Change in the settings
Re-run the server.
Dynamic segmentation¶
TREKKING_TOPOLOGY_ENABLED = True
Use dynamic segmentation or not.
Dynamic segmentation is used by default when installing Geotrek-admin.
With this mode, linear objects are built and stored related to paths.
Without this mode, linear geometry of objects is built and stored as an independent geographic object without relation to paths.
So if you want to use Geotrek-admin without dynamic segmentation, set TREKKING_TOPOLOGY_ENABLED to false after installation.
Do not change it again to true after setting it to false.
Translations¶
LANGUAGE_CODE = 'fr'
Language of your interface.
MODELTRANSLATION_LANGUAGES = ('en', 'fr', 'it', 'es')
Languages of your project. It will be used to generate fields for translations. (ex: description_fr, description_en)
You won’t be able to change it easily, avoid to add any languages and do not remove any.
Note
It is preferable, when in doubt, to include all necessary languages during the initial installation, even if some remain unused afterward, rather than missing some and facing complications to add them later.
Adding a new language¶
Note
When adding a new language to Geotrek, you must define default values for translated fields that are not NULLABLE
. The MODELTRANSLATION_LANGUAGES
command used to generate translated fields does not automatically assign these values.
For example, if you add the German language (de
) and need to add the published_de
field (indicating whether content is published in German), you must set a default value.
To ensure the database functions correctly after adding a new language, execute the following SQL queries for each affected model:
ALTER TABLE infrastructure_infrastructure ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE signage_signage ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE trekking_trek ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE trekking_poi ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE tourism_touristiccontent ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE tourism_touristicevent ADD COLUMN published_de boolean NOT NULL DEFAULT False;
ALTER TABLE flatpages_flatpage ADD COLUMN published_de boolean NOT NULL DEFAULT False;
Info
Ensure that all tables containing translated fields include this column before running the MODELTRANSLATION_LANGUAGES
command._
Spatial extents¶
Bounding box of your project : x minimum , y minimum , x max, y max:
4 ^
|
1 | 3
<-----+----->
|
|
2 v
Default values:
SPATIAL_EXTENT = (105000, 6150000, 1100000, 7150000)
Warning
If you extend spatial extent, don’t forget to load a new DEM that covers all the zone.
If you shrink spatial extent, be sure there is no element in the removed zone or you will no more be able to see and edit it.
In order to check your configuration of spatial extents, a small tool
is available at https://<server_url>/tools/extents/
. Administrator privileges are required.

Users management¶
See User management section in usage.
Database users¶
It is not safe to use the geotrek
user in QGIS, or to give its password to
many collaborators.
A wise approach, is to create a read-only user, or with specific permissions.
With pgAdmin, you can create database users like this:
CREATE ROLE lecteur LOGIN;
ALTER USER lecteur PASSWORD 'passfacile';
GRANT CONNECT ON DATABASE geotrekdb TO lecteur;
And give them permissions by schema :
GRANT USAGE ON SCHEMA public TO lecteur;
GRANT USAGE ON SCHEMA geotrek TO lecteur;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO lecteur;
GRANT SELECT ON ALL TABLES IN SCHEMA geotrek TO lecteur;
You can also create groups, etc. See PostgreSQL documentation.