In order to check your configuration of spatial extents, a small tool is available at http://server/tools/extents/.
Geotrek-admin will send emails:
- to administrators when internal errors occur
- to managers when a feedback report is created
Email configuration takes place in /opt/geotrek-admin/var/conf/custom.py
, where you control recipients emails (ADMINS
, MANAGERS
) and email server configuration.
Set configuration settings in geotrek/settings/custom.py.dist
template file.
You can test your configuration with the following command. A fake email will be sent to the managers:
API_IS_PUBLIC
Set to True
if you want the API V2 to be available for everyone without authentication.
Example:
API_IS_PUBLIC = True
Default:
False
Note
- This API provides access to promotion content (Treks, POIs, Touristic Contents ...). - Set to False
if Geotrek is intended to be used only for managing content and not promoting them. - This setting does not impact the Path endpoints, which means that the Paths informations will always need authentication to be display in the API, regardless of this setting.
INSTALLED_APPS for API V2
In order to enable swagger module to auto-document API, in the custom settings file, add the following code :
Enable API V2 documentation:
INSTALLED_APPS += ('drf_yasg', )
Then run sudo dpkg-reconfigure -u geotrek-admin
. The API swagger documentation is now availaible here : <GEOTREK_ADMIN_URL>/api/v2
As explained in the design section <design-section>
, Geotrek-admin 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.
If you want to use external services, in .env
, add following variables:
Then, you can delete all screamshotter and convertit references in docker-compose.yml
.
Now that your instances point the shared server. You can shutdown the useless services on each instance.
Start by stopping everything:
By default, the application runs on 4 processes, and timeouts after 30 seconds.
To control those values, edit and fix your docker-compose.yml
file in web and api section.
To know how many workers you should set, please refer to gunicorn documentation.
You can authenticate user against a remote database table or view.
To enable this feature, fill these fields in /opt/geotrek-admin/var/conf/custom.py
:
Expected columns in table/view are :
username
: string (unique)first_name
: stringlast_name
: stringpassword
: string (simple md5 encoded, or full hashed and salted password)email
: stringlevel
: integer (1: readonly, 2: redactor, 3: path manager, 4: trekking manager, 5: management and trekking editor, 6: administrator)structure
: stringlang
: string (language code)
Put your custom SQL in a file name /opt/geotrek-admin/var/conf/extra_sql/<app name>/<pre or post>_<script name>.sql
- app name is the name of the Django application, eg. trekking or tourism
pre_
… scripts are executed before Django migrations andpost_
… scripts after- script are executed in INSTALLED_APPS order, then by alphabetical order of script names
By default, you have two basemaps layers in your Geotrek-admin (OSM and OpenTopoMap)
You can change or add more basemaps layers like this:
LEAFLET_CONFIG['TILES']
Specify the tiles URLs this way in your custom Django setting file:
Syntax:
LEAFLET_CONFIG['TILES'] = [('NAME_OF_TILE', 'URL', 'COPYRIGHT'), ...]
Basic example:
LEAFLET_CONFIG['TILES'] = [ ('OSM', 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', '© OpenStreetMap Contributors'), ('OpenTopoMap', 'http://a.tile.opentopomap.org/{z}/{x}/{y}.png', 'Map data: © OpenStreetMap contributors, SRTM | Map style: © OpenTopoMap (CC-BY-SA)'), ]
Example with IGN and OSM basemaps:
LEAFLET_CONFIG['TILES'] = [ ( 'IGN Plan V2', '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', { 'attribution': 'Plan IGNV2 - Carte © IGN/Geoportail', 'maxNativeZoom': 16, 'maxZoom': 22 } ), ( 'IGN Orthophotos', '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=ORTHOIMAGERY.ORTHOPHOTOS&STYLE=normal&FORMAT=image/jpeg&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', { 'attribution': 'Orthophotos - Carte © IGN/Geoportail', 'maxNativeZoom': 19, 'maxZoom': 22 } ), ( 'OpenStreetMap', '//{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { 'attribution': '© <a href="https://www.openstreetmap.org/copyright">Contributeurs d\'OpenStreetMap</a>', 'maxNativeZoom': 19, 'maxZoom': 22 } ), ( 'OpenTopoMap', '//{s}.tile.opentopomap.org/{z}/{x}/{y}.png', { 'attribution': 'map data: © <a href="https://openstreetmap.org/copyright">OpenStreetMap</a> contributors, <a href="http://viewfinderpanoramas.org">SRTM</a> | map style: © <a href="https://opentopomap.org">OpenTopoMap</a> (<a href="https://creativecommons.org/licenses/by-sa/3.0/">CC-BY-SA</a>)', 'maxNativeZoom': 17, 'maxZoom': 22 } ), ( 'IGN Scan 25', '//data.geopf.fr/private/wmts?apikey=ign_scan_ws&LAYER=GEOGRAPHICALGRIDSYSTEMS.MAPS&EXCEPTIONS=text/xml&FORMAT=image/jpeg&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetTile&STYLE=normal&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', { 'attribution': 'Plan Scan 25 Touristique - Carte © IGN/Geoportail', 'maxNativeZoom': 17, 'maxZoom': 22 } ), ]
You can also configure overlays layers like this:
LEAFLET_CONFIG['OVERLAYS'] = [ ( 'IGN Cadastre', '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=CADASTRALPARCELS.PARCELLAIRE_EXPRESS&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', { 'attribution': 'Cadastre - Carte © IGN/Geoportail', 'maxNativeZoom': 19, 'maxZoom': 22 } ), ]
Note
To use some IGN Geoportail WMTS tiles (Scan25, Scan100, etc.), you may need an API key. You can find more information about this on https://geoservices.ign.fr/services-geoplateforme-diffusion.
LEAFLET_CONFIG
You can define the max_zoom the user can zoom for all tiles.
Example:
LEAFLET_CONFIG= 19
MAPENTITY_CONFIG for layers color and style
All layers colors can be customized from the settings. See Leaflet reference for vectorial layer style.
Example:
MAPENTITY_CONFIG['MAP_STYLES']['path'] = {'color': 'red', 'weight': 5}
Example with one parameter:
MAPENTITY_CONFIG['MAP_STYLES']['city']['opacity'] = 0.8
COLORS_POOL
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:
Example:
COLORS_POOL['restrictedarea'] = ['#ff00ff', 'red', '#ddddd'...]
See the default values in geotrek/settings/base.py
for the complete list of available styles.
Color of the different layers on the map :
Color of the different layers on the top right for landing.
Tip
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!
LEAFLET_CONFIG['OVERLAYS']
In custom.py
, just add the following lines:
Example:
LEAFLET_CONFIG['OVERLAYS'] = [
('Cadastre', '//data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=CADASTRALPARCELS.PARCELLAIRE_EXPRESS&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}', '© Cadastre - Carte © IGN/Geoportail')
('Coeur de parc', 'http://serveur/coeur-parc/{z}/{x}/{y}.png', '© PNF'),
]
Expected properties:
For GeoJSON
files, you can provide the following properties :
title
: stringdescription
: stringwebsite
: stringphone
: stringpictures
: list of objects withurl
andcopyright
attributescategory
: object withid
andlabel
attributes
PATH_SNAPPING_DISTANCE
Minimum distance to merge two paths in unit of SRID
Example:
PATH_SNAPPING_DISTANCE = 2.0
SNAP_DISTANCE
Distance of snapping for the cursor in pixels on Leaflet map.
Example:
SNAP_DISTANCE = 30
PATH_MERGE_SNAPPING_DISTANCE
Minimum distance to merge two paths.
Example:
PATH_MERGE_SNAPPING_DISTANCE = 2
TREK_POINTS_OF_REFERENCE_ENABLED
Points of reference are enabled on form of treks.
Example:
TREK_POINTS_OF_REFERENCE_ENABLED = True
Default:
False
OUTDOOR_COURSE_POINTS_OF_REFERENCE_ENABLED
Points of reference are enabled on form of otudoor courses.
Example:
OUTDOOR_COURSE_POINTS_OF_REFERENCE_ENABLED = True
Default:
False
TOPOLOGY_STATIC_OFFSETS
Land objects are added on other objects (path for example) with offset, avoiding overlay.
Example:
TOPOLOGY_STATIC_OFFSETS = {'land': -5, 'physical': 0, 'competence': 5, 'signagemanagement': -10, 'workmanagement': 10}
Example with more overlays:
TOPOLOGY_STATIC_OFFSETS = {'land': -7, 'physical': 0, 'competence': 7, 'signagemanagement': -14, 'workmanagement': 14}
All settings used to generate altimetric profile :
Note
- All these settings can be modified but you need to check the result every time - The only one modified most of the time is ALTIMETRIC_PROFILE_COLOR
MAPENTITY_CONFIG for map background
Since IGN map backgrounds are very dense and colourful, a dark opacity is applied. In order to disable, change this MapEntity setting:
Example:
MAPENTITY_CONFIG['MAP_BACKGROUND_FOGGED'] = False
Default:
True
MAP_CAPTURE_SIZE
Show objects on maps of PDF
Example:
MAP_CAPTURE_SIZE = 800
In order to disable a full set of modules, in the custom settings file, add the following code:
TRAIL_MODEL_ENABLED
In order to remove notion of trails.
Example:
TRAIL_MODEL_ENABLED = False
Default:
True
LANDEDGE_MODEL_ENABLED
In order to remove landedge model.
Example:
LANDEDGE_MODEL_ENABLED = False
Default:
True
In order to remove zoning combo-boxes on list map:
TOURISM_ENABLED
In order to hide TouristicContents and TouristicEvents on menu.
Example:
TOURISM_ENABLED = False
Default:
True
FLATPAGES_ENABLED
In order to hide Flatpages on menu. Flatpages are used in Geotrek-rando.
Example:
FLATPAGES_ENABLED = False
Default:
True
ACCESSIBILITY_ATTACHMENTS_ENABLED
In order to hide the accessibility menu for attachments.
Example:
ACCESSIBILITY_ATTACHMENTS_ENABLED = False
Default:
True
ALLOW_PATH_DELETION_TOPOLOGY
If False
, it forbids to delete a path when at least one topology is linked to this path.
Example:
ALLOW_PATH_DELETION_TOPOLOGY = True
Default:
False
ALERT_DRAFT
If True
, it sends a message to managers (MANAGERS) whenever a path has been changed to draft.
Example:
ALERT_DRAFT = False
Default:
True
ALERT_REVIEW
If True
, it sends a message to managers (MANAGERS) whenever an object which can be published has been changed to review mode.
Example:
ALERT_REVIEW = False
Default:
True
BLADE_ENABLED
and LINE_ENABLED
settings (default to True
) allow to enable or disable blades and lines submodules.
DIRECTION_ON_LINES_ENABLED
setting (default to False
) allow to have the direction field on lines instead of blades.
BLADE_CODE_TYPE
Type of the blade code (string or integer)
Example:
BLADE_CODE_TYPE = INT
BLADE_CODE_FORMAT
Correspond to the format of blades. Show N3-1 for the blade 1 of the signage N3.
Example:
BLADE_CODE_FORMAT = "{signagecode}-{bladenumber}"
LINE_CODE_FORMAT
Corresponds to the format used in export of lines. Used in csv of signage
Example:
LINE_CODE_FORMAT = "{signagecode}-{bladenumber}-{linenumber}"
TREK_POI_INTERSECTION_MARGIN
Buffer around treks to intersects POIs (works only without dynamic segmentation)
Example:
TREK_POI_INTERSECTION_MARGIN = 500 # meters
Default:
500
INSTALLED_APPS for Diving
In order to enable diving module, in the custom settings file, add the following code:
Example:
INSTALLED_APPS += ('geotrek.diving', )
Then run sudo dpkg-reconfigure -pcritical geotrek-admin
.
You can also insert diving minimal data (default practices, difficulties, levels and group permissions values):
You can insert licenses of attachments with this command :
You can insert circulation and authorization types with this command :
sudo geotrek loaddata /opt/geotrek-admin/lib/python*/site-packages/geotrek/land/fixtures/circulations.json
INSTALLED_APPS for Outdoor
In order to enable Outdoor module, in the custom settings file, add the following code:
Example:
INSTALLED_APPS += ('geotrek.outdoor', )
Then run sudo dpkg-reconfigure -pcritical geotrek-admin
.
You can also insert Outdoor minimal data:
After installing Outdoor module, you have to add permissions to your user groups on outdoor sites and courses.
INSTALLED_APPS for Sensitive areas
In order to enable sensitivity module, in the custom settings file, add the following code:
Example:
INSTALLED_APPS += ('geotrek.sensitivity', )
You can insert rules of sensitive area with these commands :
sudo geotrek loaddata /opt/geotrek-admin/lib/python*/site-packages/geotrek/sensitivity/fixtures/rules.json
cp -r /opt/geotrek-admin/lib/python*/site-packages/geotrek/sensitivity/fixtures/upload/rules/ /opt/geotrek-admin/var/media/upload/
The following settings are related to sensitive areas:
SENSITIVITY_DEFAULT_RADIUS
Default radius of sensitivity bubbles when not specified for species
Example:
SENSITIVITY_DEFAULT_RADIUS = 100 # meters
Default:
100
SENSITIVE_AREA_INTERSECTION_MARGIN
Buffer around treks to intersects sensitive areas
Example:
SENSITIVE_AREA_INTERSECTION_MARGIN = 500 # meters
Default:
500
Import from https://biodiv-sports.fr
In user interface, in the top-right menu, clic on "Imports" and choose "Biodiv'Sports".
On command line, run
In user interface, in the top-right menu, go to Imports and choose "Shapefile zone sensible espèce" or "Shapefile zone sensible réglementaire".
Note
The file must be a zip containing all the shapefile extensions (.shp, .shx, .prj, .dbf, .cpg)
On command line, run:
or:
Attributes for "zones espèces sensibles" are:
espece
: species name. Mandatory. A species with this name must have been previously created.contact
: contact (text or HTML format). Optional.descriptio
: description (text or HTML format). Optional.
Attributes for "zones sensibles réglementaires" are:
name
: zone name.contact
: contact (text or HTML format). Optional.descriptio
: description (text or HTML format). Optional.periode
: month numbers of zone occupation, separated by comas, without spaces (ex. « 6,7,8 » for june, july and august)pratiques
: sport practices names, separated by comas, without spaces (ex. « Terrestre,Aérien »). A sport practice with this name must have been previously created.url
: card url. Optional.
Just run:
If sensitivity module is enabled, sensitive areas will be automatically synchronized.
SEND_REPORT_ACK
If False
, no email will be sent to the sender of any feedback on Geotrek-rando website.
Example:
SEND_REPORT_ACK = True
Default:
False
Suricate is the French national database gathering such reports. It exposes an API for external software to connect to. For Geotrek to connect to Suricate, you need to request two pairs of API keys allowing access.
Geotrek reports can work together with Suricate API, using one of three modes. Proceed through a mode full configuration before proceeding to the next mode.
1 - No Suricate (default)
This mode sends no report data to Suricate.
To initialize Report forms (Geotrek-admin, Geotrek-rando-V2, Geotrek-rando-V3) load lists for categories, activities, statuses and problem magnitude:
To make these lists available for your Geotrek-rando-V2, run sync_rando
(see synchronization <synchronization-section>
)
2 - Suricate Standard
This mode simply forwards all reports to Suricate, using the Standard API to post reports.
Set your account settings in custom.py
:
3 - Suricate Management (Workflow)
This mode allows to retrieve reports and related data directly from Suricate, using the Management API to get data. It is used to process and manage reports, using the Intervention module and following a predefined worklow, while sending all progress to Suricate. It implies enabling Suricate Report mode as well.
Suricate workflowSuricate Workflow mode defines a strict process, composed of several steps representing the lifecycle of a user report, from creation to closing. A report is always characterized with a status, depicting how far in the process the report is, and displayed using a specific color on the map.
Reports
- A report consists of the following information :
- A GPS position
- A message describing the problem
- A category : environment, security, usage conflit, signages
- A magnitude : usage is possible, difficult, or impossible
- A practice : trekking, cycling, horse-riding…
- Up to three pictures
Stakeholders and responsibility
- This workflow defines three stakeholders categories :
- The sentinel : the person who submitted the report. They do not have a Geotrek user account nor intervene in the workflow, but they are kept updated on the processing of their report via semi-automatic e-mails.
- Supervisors : they are assigned (a) report(s) for treatment. They are tasked with planning an Intervention on Geotrek and enter information about it.
- The manager : they maintain a global view of all reports on the territory, assign reports to supervisors, handle messaging to the sentinel, and confirm reports resolution.
Any Geotrek user account can be used as a supervisor, as long as they have proper access and modification rights on both Report and Intervention modules. There can only be one Manager.
Report processing
Every night, Geotrek fetches new reports and updates through Suricate API. The manager receives an e-mail listing new reports (with “Filed” status). They can visualize them on Geotrek.
1 - Qualification
- The manager has three options when handling a newly filed report:
- Classify : The report isn’t relevant. The manager sets the report to “Classified” and enters a message for the sentinel, explaining their choice. The report is considered closed.
- Reject treatment : The report does not involve an area or an equipment under responsibility of the workflow users, but could be handled by another member of the Suricate community. The report is excluded from Geotrek workflow but is still accessible to the community via other applications using Suricate API.
- Assignation : The manager selects a supervisor from a drop-down selector, and enters a message with instructions or further information. The supervisor receives an e-mail notifying them about the newly assigned report, along with the manager’s message. * The manager also enters a message destined to the sentinel, to notify them that the report is about to be handled. The report is set to status “Waiting”. Only after assignation can we proceed to the following steps.
2 - Planification
The supervisor logs onto Geotrek and creates an Intervention linked to the assigned report, with a planification date. The intervention has status “Plannified”. If too many days have passed between report assignation and intervention creation, the report is automatically set to “Late intervention” status, marked with color red, and the supervisor receives a reminder by e-mail.
3 - Resolution
The supervisor sets their intervention to “Resolved” status. The manager receives an e-mail notifying that a report is ready to be closed. If too many days have passed between intervention creation and intervention resolution, the report is automatically set to “Late resolution” status, marked with color red, and the supervisor receives a reminder e-mail.
4 - Closing
Following the intervention’s resolution, the manager has to confirm the report was handled and sets it to “Resolved”. They enter a message for the sentinel to inform them that the report’s processing is over. The report is considered closed.
5 - GPS relocalisation
At any point, the manager or the supervisor can re-define GPS location for the report. Relocating it outside of the district marked as workflow responsibility area causes the treatment to be rejected (see part 1 Qualification). Furthermore, it is now possible to display the report layer on other Geotrek modules, for instance to compare positions between reports and signages or treks.
6 - Reports visibility
When a supervisor logs in to Geotrek, they can only see reports that are currently assigned to them. Both the manager and administrators can see all existing reports.
7 - Predefined messages
As we have seen above, the manager enters messages destined to the sentinel or to supervisors. These messages can be predefined in the administration interface and picked from a drop-down selector, then modified before sending. It is possible to automatically retrieve in a message the intervention date and the username of the supervisor that handled it.
Workflow configuration
Even though the workflow is a strict process, the following items are customisable.
- Through administration interface :
- Colors for each status
- Selecting the manager
- Selecting the workflow responsibility area
- Predefined messages
- Through application configuration:
- API keys to connect to Suricate
- Enabling of Workflow mode or any other mode
- Enabling/disabling status colors on map
- Duration of timers setting reports to “late” statuses
Synchronization and network losses
- Communication between Suricate and Geotrek operates as follows :
- Suricate to Geotrek : new information is fetched once a night
- Geotrek to Suricate : every report update on Geotrek is immediately forwarded to Suricate
Maintaining synchronization between Suricate and Geotrek confronts us to the challenges of distributed software architecture. At any point, the connection between both applications can be lost, meaning that Suricate and Geotrek will no longer agree on a report’s status. Most of the time, this is simply due to temporary network failure. A system is in place to compensate for such failures. If a request to Suricate API fails, it is stored in the database and resent a few hours later. In case of a long term loss of connection, Django commands are available for an administrator to run some connection tests and resend stored information once connection is recovered.
For technical documentation refer to : https://geotrek.ecrins-parcnational.fr/ressources/technique/2023-02-Geotrek-Suricate-configuration.pdf
You can find the same detailled explanation on the workflow in this article in french : https://makina-corpus.com/geotrek/gestion-territoires-naturels-geotrek-traitement-signalements-suricate
- Set your settings in
custom.py
:
You can use the following command to test your connection settings:
Load lists for activities and/or report statuses from Suricate:
Load alerts from Suricate (located in your bounding box) :
To make these lists available for your Geotrek-rando, run sync_rando
(see synchronization <synchronization-section>
)
- Then load extra required statuses for Reports and Interventions:
- Go to the configuration site and :
- if you want to include the moderation steps (
SKIP_MANAGER_MODERATION = False
), select a user as Workflow Manager (/admin/feedback/workflowmanager/). Their role is to assign reports to other users. - select a district as Workflow District (/admin/feedback/workflowdistrict/). This zone defines the area of reponsibility for reports. Reports relocated outside of the district will be excluded from workflow.
- create predefined emails (/admin/feedback/predefinedemail/) to notify Suricate Sentinels and Administrators. You can use ##intervention_end_date## and ##supervisor## in the messages' body to automatically replace with the report's linked Intervention date and author. The Extended Username field will be dsiplayed (see User Profile under /admin/auth/user/).
- Make sure Users involved in the workflow have proper permissions to create and update Reports and Interventions (/admin/auth/user/)
- if you want to include the moderation steps (
Make sure to run these three commands daily to maintain synchronization and update reports (thanks to cron for instance) :
ENABLE_REPORT_COLORS_PER_STATUS
Go to the Configuration site and select colors to display for each status (/admin/feedback/reportstatus/).
Example:
ENABLE_REPORT_COLORS_PER_STATUS = True
Default:
False
Tip
- It is possible to enable receiving email alerts for reports that have remained in the same status for too long. - For instance, I can create two report statuses "To program" with timer days set to 10 and "Programmed" with timer days set to 0. - If a report has had status "To program" for 10 days, an email alert will be sent. If its status is changed to "Programmed" within these 10 days, this will cancel the alert. - The email alert will be sent to the assigned user for this report, or to managers (setting MANAGERS) if there is no assigned user.
To enable the alerts :
- Go to the Configuration module and set "Timer days" to some integer other than 0 in relevant statuses (/admin/feedback/reportstatus/)
- Select the "Uses timers" checkbox on reports that you wish to receive alerts for (in report update form)
- Make sure to run this commands daily to send email alerts and clear obsolete timers (thanks to cron for instance) :
To be compliant to GDPR, you cannot keep personnal data infinitely, and should notice your users on how many time you keep their email.
A Django command is available to anonymize reports, by default older than 365 days.
Or if you want to erase emails for reports older than 90 days
MAPENTITY_CONFIG for medias
Attached files are downloaded by default by browser, with the following line, files will be opened in the browser :
Example:
MAPENTITY_CONFIG['SERVE_MEDIA_AS_ATTACHMENT'] = False
Default:
True
PAPERCLIP_RESIZE_ATTACHMENTS_ON_UPLOAD
Attached pictures can be resized at upload by enabling this parameter :
Example:
PAPERCLIP_RESIZE_ATTACHMENTS_ON_UPLOAD = True
Default:
False
These corresponding height/width parameters can be overriden to select resized image size:
PAPERCLIP_MAX_BYTES_SIZE_IMAGE
If you want to prohibit the usage of heavy pictures:
Example:
PAPERCLIP_MAX_BYTES_SIZE_IMAGE = 50000 # Bytes
If you want to prohibit the usage of small pictures in pixels:
These three settings will also not allow downloading images from the parsers.
Paperclip will only accept attachment files matching a list of allowed extensions. Here is the default value for this setting, which you can extend if needed:
It will verify that the mimetype of the file matches the extension.
PAPERCLIP_EXTRA_ALLOWED_MIMETYPES
You can add extra allowed mimetypes for a given extension with the following syntax:
Example:
PAPERCLIP_EXTRA_ALLOWED_MIMETYPES['gpx'] = ['text/xml']
PAPERCLIP_ALLOWED_EXTENSIONS
You can also entirely deactivate these checks with the following:
Example:
PAPERCLIP_ALLOWED_EXTENSIONS = None
For each module, use the following syntax to configure columns to display in the main table.
For each module, use the following syntax to configure columns to export as CSV or SHP.
Another setting exists to enable a more detailed export of jobs costs in the interventions module. When enabling this settings, interventions list exports will contain a new column for each job's total cost.
ENABLE_JOBS_COSTS_DETAILED_EXPORT
Enable a more detailed export
Example:
ENABLE_JOBS_COSTS_DETAILED_EXPORT = True
Default:
False
A (nearly?) exhaustive list of attributes available for display and export as columns in each module.
HIDDEN_FORM_FIELDS
For each module, use the following syntax to configure fields to hide in the creation form.
Example:
HIDDEN_FORM_FIELDS['<module>'] = ['list', 'of', 'fields']
An exhaustive list of form fields hideable in each module.
Set error_on_publication
to avoid publication without completeness fields and error_on_review
if you want this fields to be required before sending to review.
COMPLETENESS_LEVEL
Configure completeness level
Example:
COMPLETENESS_LEVEL = 'warning'
COMPLETENESS_FIELDS
For each module, configure fields to be needed or required on review or publication
Example:
COMPLETENESS_FIELDS = {
'trek': ['practice', 'departure', 'duration', 'difficulty', 'description_teaser'],
'dive': ['practice', 'difficulty', 'description_teaser'],
}
Text form fields are enhanced using TinyMCE.
Its configuration can be customized using advanced settings (see above paragraph).
TINYMCE_DEFAULT_CONFIG
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 :
Example:
TINYMCE_DEFAULT_CONFIG = {
'theme_advanced_buttons1': 'bold,italic,forecolor,separator,code',
'valid_elements': "img,p,a,em/i,strong/b",
}
MAPENTITY_CONFIG for characters
Add MAX_CHARACTERS
setting to be able to define a maximum number of characters for text fields (to be used with django-mapentity >= 8.1).
Example:
MAPENTITY_CONFIG['MAX_CHARACTERS'] = 1500
THUMBNAIL_COPYRIGHT_FORMAT
If you want copyright added to your pictures, change this parameter like so :
Example:
THUMBNAIL_COPYRIGHT_FORMAT = "{title} {author}"
You can also add {legend}
: "{title}-:-{author}-:-{legend}"
THUMBNAIL_COPYRIGHT_SIZE
Change the size of thumbnail
Example:
THUMBNAIL_COPYRIGHT_SIZE = 15
When a content is shared to Facebook in Geotrek-rando V2, it needs static html files built by synchronization (thanks to option --rando-url
).
In Facebook developper dashboard, create a Facebook app dedicated to Geotrek-rando and activate it.
FACEBOOK_APP_ID
In custom.py
set Facebook App ID:
Example:
FACEBOOK_APP_ID = '<your Facebook AppID>'
You can also override these settings:
Translations are managed by https://weblate.makina-corpus.net/ where you can contribute. But you can also override default translation files available in each module (for example those from trekking module available in /opt/geotrek-admin/lib/python3.6/site-packages/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:
- Create a
django.po
file in/opt/geotrek-admin/var/conf/extra_locale
directory. - You can do one folder and one
django.po
file for each language (example/opt/geotrek-admin/var/conf/extra_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:
Apply changes (French translation in this example):
PDF are generated from HTML templates, using Django templating. Treks, touristic contents, touristic events, outdoor sites and courses 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/touristicevent_public_pdf.html
- Outdoor sites :
geotrek/outdoor/templates/outdoor/site_public_pdf.html
- Outdoor courses :
geotrek/outdoor/templates/outdoor/course_public_pdf.html
Overriden templates have to be located in /opt/geotrek-admin/var/conf/extra_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 /opt/geotrek-admin/var/conf/extra_templates/trekking/trek_public_pdf.html
. Or add inside your file:
{% extends "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 /opt/geotrek-admin/var/conf/extra_templates/trekking/trek_public_pdf.html
.
It is also possible to use color defined for practice for pictogram by adding in your /opt/geotrek-admin/var/conf/extra_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 /opt/geotrek-admin/var/conf/extra_templates/trekking/trek_public_pdf.css
for example.
You can also create a template for each portal.
Add a folder portal_{id_portal}
(portal ids are located in the portal url path /admin/common/targetportal/{id_portal}
) in /opt/geotrek-admin/var/conf/extra_templates/<appname>
, as the first template, and add at the top of your file:
{% extends "trekking/trek_public_pdf.html" %}
The template for a specific portal will use the modification made on the overriden template in /opt/geotrek-admin/var/conf/extra_templates/<appname>
( except if you change specific block)
You might need to use your own images in the PDF templates.
Add your own images in /opt/geotrek-admin/var/conf/extra_static/images/
.
You can then use these images in your PDF templates with {% static 'images/file.jpg' %}
, after adding {% load static %}
at the top of the file.
Example of a customised template (/opt/geotrek-admin/var/conf/extra_templates/trekking/trek_public_pdf.html
) with a customised logo and URL:
{% extends "trekking/trek_public_pdf.html" %}
{% load static %}
{% block logo %}
<img src="{% static 'images/logo-gte.jpg' %}" alt="Grand tour des Ecrins">
{% endblock %}
{% block url %}
<div class="main">Grand tour des Ecrins</div>
<div class="geo"><a href="https://www.grand-tour-ecrins.fr">grand-tour-ecrins.fr</a></div>
{% endblock url %}
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.
USE_BOOKLET_PDF
Use booklet for PDF
Example:
USE_BOOKLET_PDF = True
Default:
False
Note
- During the synchro, pois details will be removed, and the pages will be merged. - It is possible to customize the pdf, with trek_public_booklet_pdf.html.
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.
MAPENTITY_CONFIG for custom colors in PDF
Trek export geometries are translucid red by default. In order to control the apparence of objects in public trek PDF exports, use the following setting:
Example:
MAPENTITY_CONFIG['MAP_STYLES']['print']['path'] = {'weight': 3}
See Leaflet reference documentation for detail about layers apparence.
PRIMARY_COLOR
You can override PRIMARY_COLOR
to change emphase text in PDF export.
Example:
PRIMARY_COLOR = "#7b8c12"
Note
Beware of contrast, white colour is used for text so we advise you to avoid light colour.
You might also need to deploy logo images in the following places :
var/conf/extra_static/images/favicon.png
var/conf/extra_static/images/logo-login.png
var/conf/extra_static/images/logo-header.png
With Geotrek-rando V2, there is a synchronization mechanism to expose Geotrek-admin contents in json files generated automatically.
Warning
This is no more used in Geotrek-rando V3.
SYNC_RANDO_ROOT
Path on your server where the data for Geotrek-rando website will be generated
Example:
SYNC_RANDO_ROOT = os.path.join(VAR_DIR, 'data')
Note
- If you want to modify it, do not forget to import os at the top of the file. - Check import Python , if you need any information
SYNC_RANDO_OPTIONS
Options of the sync_rando command in Geotrek-admin interface.
Example:
SYNC_RANDO_OPTIONS = {}
TOURISM_INTERSECTION_MARGIN
Distance to which tourist contents, tourist events, treks, pois, services will be displayed
Example:
TOURISM_INTERSECTION_MARGIN = 500 # meters
Default:
500
Note
This distance can be changed by practice for treks in the admin.
DIVING_INTERSECTION_MARGIN
Distance to which dives will be displayed.
Example:
DIVING_INTERSECTION_MARGIN = 500 # meters
Default:
500
TREK_EXPORT_POI_LIST_LIMIT
Limit of the number of POIs on treks pdf.
Example:
TREK_EXPORT_POI_LIST_LIMIT = 14
Note
14
is already a huge amount of POI, but it's possible to add more
TREK_EXPORT_INFORMATION_DESK_LIST_LIMIT
Limit of the number of information desks on treks pdf.
Example:
TREK_EXPORT_INFORMATION_DESK_LIST_LIMIT = 14
Note
You can put -1
if you want all the information desks
SPLIT_TREKS_CATEGORIES_BY_PRACTICE
On the Geotrek-rando V2 website, treks practices will be displayed separately
Example:
SPLIT_TREKS_CATEGORIES_BY_PRACTICE = False
Default:
True
Note
Field order for each practices in admin will be taken in account
SPLIT_TREKS_CATEGORIES_BY_ACCESSIBILITY
On the Geotrek-rando V2 website, accessibilites will be displayed separately
Example:
SPLIT_TREKS_CATEGORIES_BY_ACCESSIBILITY = False
Default:
True
SPLIT_TREKS_CATEGORIES_BY_ITINERANCY
On the Geotrek-rando V2 website, if a trek has a children it will be displayed separately
Example:
SPLIT_TREKS_CATEGORIES_BY_ITINERANCY = False
Default:
True
SPLIT_DIVES_CATEGORIES_BY_PRACTICE
On the Geotrek-rando V2 website, dives practices will be displayed separately
Example:
SPLIT_DIVES_CATEGORIES_BY_PRACTICE = True
Default:
False
HIDE_PUBLISHED_TREKS_IN_TOPOLOGIES
On the Geotrek-rando V2 website, treks near other are hidden
Example:
HIDE_PUBLISHED_TREKS_IN_TOPOLOGIES = False
Default:
True
TREK_WITH_POIS_PICTURES
It enables correlated pictures on Geotrek-rando V2 to be displayed in the slideshow
Example:
TREK_WITH_POIS_PICTURES = False
Default:
True
ONLY_EXTERNAL_PUBLIC_PDF
On Geotrek-rando V2 website, only PDF imported with filetype "Topoguide"will be used and not autogenerated.
Example:
ONLY_EXTERNAL_PUBLIC_PDF = False
Default:
True
Order of all the objects without practices on Geotrek-rando website :
Note
- All the settings about order are the order inside Geotrek-rando website. - Practices of diving, treks and categories of touristic contents are taken in account
SYNC_MOBILE_ROOT
Path on your server where the datas for mobile will be saved.
Example:
SYNC_MOBILE_ROOT = os.path.join(VAR_DIR, 'mobile')
Note
- If you want to modify it, do not forget to import os at the top of the file. - Check import Python , if you need any information
SYNC_MOBILE_OPTIONS
Options of the sync_mobile command.
Example:
SYNC_MOBILE_OPTIONS = {'skip_tiles': False}
Default:
True
MOBILE_NUMBER_PICTURES_SYNC
Number max of pictures that will be displayed and synchronized for each object (trek, POI, etc.) in the mobile app.
Example:
MOBILE_NUMBER_PICTURES_SYNC = 3
MOBILE_TILES_URL
URL's Tiles used for the mobile.
Example with OpenTopoMap:
MOBILE_TILES_URL = ['https://{s}.tile.opentopomap.org/{z}/{x}/{y}.png']
Example with IGN:
MOBILE_TILES_URL = ['https://data.geopf.fr/wmts?SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=GEOGRAPHICALGRIDSYSTEMS.PLANIGNV2&STYLE=normal&FORMAT=image/png&TILEMATRIXSET=PM&TILEMATRIX={z}&TILEROW={y}&TILECOL={x}']
MOBILE_LENGTH_INTERVALS
Intervals of the mobile for the length filter.
Example:
MOBILE_LENGTH_INTERVALS = [ {"id": 1, "name": "< 10 km", "interval": [0, 9999]}, {"id": 2, "name": "10 - 30", "interval": [9999, 29999]}, {"id": 3, "name": "30 - 50", "interval": [30000, 50000]}, {"id": 4, "name": "> 50 km", "interval": [50000, 999999]} ]
Note
- Interval key is in meters. - You can add new intervals
MOBILE_ASCENT_INTERVALS
Intervals of the mobile for the ascent filter.
Example:
MOBILE_ASCENT_INTERVALS = [ {"id": 1, "name": "< 300 m", "interval": [0, 299]}, {"id": 2, "name": "300 - 600", "interval": [300, 599]}, {"id": 3, "name": "600 - 1000", "interval": [600, 999]}, {"id": 4, "name": "> 1000 m", "interval": [1000, 9999]} ]
Note
Do the same as above
MOBILE_DURATION_INTERVALS
Intervals of the mobile for the duration filter.
Example:
MOBILE_DURATION_INTERVALS = [ {"id": 1, "name": "< 1 heure", "interval": [0, 1]}, {"id": 2, "name": "1h - 2h30", "interval": [1, 2.5]}, {"id": 3, "name": "2h30 - 5h", "interval": [2.5, 5]}, {"id": 4, "name": "5h - 9h", "interval": [5, 9]}, {"id": 5, "name": "> 9h", "interval": [9, 9999999]} ]
Note
Check MOBILE_LENGTH_INTERVALS
section to use it, here interval correspond to 1 unit of hour
ENABLED_MOBILE_FILTERS
List of all the filters enabled on mobile.
Example:
ENABLED_MOBILE_FILTERS = [ 'practice', 'difficulty', 'durations', 'ascent', 'lengths', 'themes', 'route', 'districts', 'cities', 'accessibilities', ]
Note
Remove any of the filters if you don't want one of them. It's useless to add other one.