Read-only mirror of https://github.com/sitn/sitn_applications — Canton de Neuchâtel. Issues & pull requests at the source.
  • Python 62.5%
  • HTML 23.5%
  • JavaScript 12%
  • CSS 1.9%
  • Dockerfile 0.1%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-08-24 15:44:38 +02:00
action_sociale squashmigratioms 2026-01-14 16:01:38 +01:00
cadastre Merge remote-tracking branch 'maltaesousa/ppe' into ppe 2026-01-15 15:44:47 +01:00
cats add login buttons to apps 2026-06-19 14:45:53 +02:00
db init tests 2024-02-19 15:50:53 +01:00
ecap crlf 2026-01-15 15:37:51 +01:00
ecap_intra crlf 2026-01-15 15:37:51 +01:00
emails_sent init tests 2024-02-19 15:50:53 +01:00
forest_forpriv crlf 2026-01-15 15:37:51 +01:00
health translate 2026-06-23 15:28:27 +02:00
intranet_proxy crlf 2026-01-15 15:37:51 +01:00
locale/fr/LC_MESSAGES allow email for health feedback 2026-03-18 08:26:49 +01:00
panoview filter by age 2026-07-31 10:25:28 +02:00
parcel_historisation unused old code 2026-07-24 11:56:18 +02:00
ppe fix unauthorized access to dossier list 2026-08-24 14:35:18 +02:00
registre_foncier Merge pull request #98 from kalbermattenm/rf 2026-06-24 14:19:00 +02:00
roads last test name 2026-02-27 14:43:52 +01:00
sitn unused old code 2026-07-24 11:56:18 +02:00
static/images CRLF 2026-05-19 16:57:23 +02:00
stationnement crlf 2026-01-15 15:37:51 +01:00
.env.sample unused old code 2026-07-24 11:56:18 +02:00
.gitattributes update attributes 2026-05-19 16:55:14 +02:00
.gitignore package locally 2026-07-23 13:56:36 +02:00
__init__.py crlf 2026-01-15 15:37:51 +01:00
deploy update python, django, gdal 2025-10-10 12:19:50 +02:00
docker-compose.yml implemented fixed download link and prototype info 2026-02-06 14:23:23 +01:00
Dockerfile workingppe base version for sitn applications 2026-01-22 17:51:40 +01:00
LICENSE Initial commit 2022-06-28 12:08:05 +02:00
manage.py Initial commit and application 2022-06-28 14:28:12 +02:00
pylintrc Initial commit and application 2022-06-28 14:28:12 +02:00
README.md fix get-data 2026-05-28 15:47:38 +02:00
requirements-lock.txt import panoramas outside django 2026-07-21 16:22:20 +02:00
requirements.in import panoramas outside django 2026-07-21 16:22:20 +02:00
startup.sh update python, django, gdal 2025-10-10 12:19:50 +02:00
wsgi.py fix documentation and project 2023-02-20 16:08:56 +01:00

sitn_applications

Apps and custom webservices from SITN. This app can run in two different contexts: internet or intranet. Depending on the context, some apps will not be installed when deploying.

Requirements

  • PostgreSQL >= 11 + PostGIS
  • Python >= 3.10
  • GDAL, GEOS (if running without docker on Windows, install OSGEO4W and add its bin directory to the Path)
  • GNU gettext https://www.gnu.org/software/gettext/

Getting started

Fork and clone this repository. Make a copy of the .env.sample file and adapt it to your environment settings:

cp .env.sample .env

and configure the different variables.

The paths related to GDAL et GEOS can either point to existing installations on the system, e.g.:

# Path to the folder containing all GDAL/GEOS DLLs
GDAL_PATH="C:/Program Files/GDAL/"

# Full path to the GDAL DLL
GDAL_LIBRARY_PATH="C:/Program Files/GDAL/gdal.dll"

# Full path to GEOS C API DLL
GEOS_LIBRARY_PATH="C:/Program Files/PostgreSQL/16/bin/libgeos_c.dll"

Alternatively, you can install GDAL (and its GEOS and PROJ dependencies), using the geospatial python wheels provided here:

Download the appropriate version, then install it in the venv using pip, e.g.:

pip install .\gdal-3.11.4-cp314-cp314-win_amd64.whl

Then configure the GDAL paths in the .env file to point to the ressources in the venv, e.g.:

# Path to the folder containing all GDAL/GEOS DLLs
GDAL_PATH="C:/Projects/sitn_applications/venv/Lib/site-packages/osgeo/"

# Full path to the GDAL DLL
GDAL_LIBRARY_PATH="C:/Projects/sitn_applications/venv/Lib/site-packages/osgeo/gdal.dll"

# Full path to GEOS C API DLL
GEOS_LIBRARY_PATH="C:/Projects/sitn_applications/venv/Lib/site-packages/osgeo/geos_c.dll"

You should also have PostgreSQL with PostGIS installed, and the path to PostgreSQL's bin directory should be defined in the Path variable in your Windows system environment variables (e.g. C:\Program Files\PostgreSQL\18\bin).

Finally, you need to have gettext installed:

Running in development mode, without docker

First, create a copy of the .env.sample file called .env:

cp .env.sample .env

Install and activate the virtual environment:

python -m venv venv
./venv/Scripts/activate
python -m pip install --upgrade pip
pip install -r requirements-lock.txt

Create a local database:

python manage.py createdb

Dump some fresh data from prod database

python manage.py getdata

Run migrations

python manage.py migrate

You're now ready to go:

python manage.py collectstatic
python manage.py compilemessages --locale=fr
python manage.py runserver

Switching between the Internet & Intranet instances

If developping on the Internet instance, then you should define a new environment variable in the .env.dev. file:

IS_INTRANET=False

Running locally on Docker

First, create a copy of the env.sample file called env.<context>.local:

cp .env.sample .env.intranet.local

Then you'll be able to deploy locally on docker:

python deploy intranet local

Deploying on production

Deployments are based on shared .env files. If your project requires migrations, the default user will not be able to create tables, so you must temporarily switch to a more privileged user.

Then you'll be able to deploy your instance with python deploy <context> <instance>

Example:

python deploy intranet prepub

Tests

Running tests will require a database for testing.

python manage.py testdb

then you can run tests

python manage.py test --keepdb

Translations

Prepare translation files

django-admin makemessages -l fr --no-location --ignore venv

then compile them

python manage.py compilemessages --locale=fr

Starting a new app

python manage.py startapp myapp

Then:

  1. Put something in urls.py in your app folder
  2. Import your urls in sitn/urls.py
  3. Install the app in settings.py

Upgrading packages

In your venv:

  1. Update the versions manually in requirements.in if necessary
  2. pip-compile requirements.in --upgrade --output-file=requirements-lock.txt
  3. pip install -r requirements-lock.txt