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.
- PostgreSQL >= 11 + PostGIS
- Python >= 3.10
- GDAL (if running without docker)
- GNU gettext https://www.gnu.org/software/gettext/
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.
First, create a copy of the .env.sample
file called .env
:
cp .env.sample .env
Install and activate the virual environment:
python -m venv venv
./venv/Scripts/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
Create a local database:
python manage.py createdb
Run migrations
python manage.py migrate
Dump some fresh data from prod database
python manage.py getdata
You might want to create an admin user:
python manage.py createsuperuser
You're now ready to go:
python manage.py collectstatic
python manage.py compilemessages --locale=fr
python manage.py runserver
If developping on the Internet instance, then you should define a new environment variable
in the .env.dev.
file:
IS_INTRANET=False
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
First, create a copy of the env.sample
file called env.<context>.<instance>
, example:
cp .env.sample .env.intranet.prod
Then you'll be able to deploy your instance with python deploy <context> <instance>
python deploy intranet prod
Running tests will require a database for testing.
python manage.py testdb
then you can run tests
python manage.py test --keepdb
Prepare translation files
django-admin makemessages -l fr
then compile them
python manage.py compilemessages --locale=fr
python manage.py startapp myapp
Then:
- Put something in
urls.py
in your app folder - Import your urls in
sitn/urls.py
- Install the app in
settings.py