Discover geocity features and usage here
This will bring up a demo instance with preset fixtures served by the Django developpment server in reload mode.
git clone git@github.com:yverdon/geocity.git && cd geocity
cp -n env.demo .env
docker-compose -f docker-compose-dev.yml build
docker-compose -f docker-compose-dev.yml down --remove-orphans && docker-compose -f docker-compose-dev.yml up
This process will create the .env file only if it does not already exist
The demo application is now running on localhost:9095
To debug and view the resulting docker-compose-dev.yml
file use (uses the .env
file for variables substitution):
docker-compose -f docker-compose-dev.yml config
List running containers:
$ docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
de8f58bf2e2c gms_web "/code/entrypoint_de…" 16 hours ago Up 16 hours 0.0.0.0:9095->9000/tcp geocity_web_1
ab542f438d62 camptocamp/qgis-server:3.10 "/usr/local/bin/star…" 16 hours ago Up 16 hours 0.0.0.0:9096->80/tcp geocity_qgisserver_1
ffaa9f6c1b21 camptocamp/postgres:11 "docker-entrypoint.s…" 16 hours ago Up 16 hours 0.0.0.0:9097->5432/tcp geocity_postgres_1
Enter the container:
$ docker exec -it de8f58bf2e2c bash
Run the tests:
root@de8f58bf2e2c:/code# ./run_tests.sh
Example to run a single test in container
coverage run --source='.' ./manage.py test --settings=geomapshark.settings_test permits.tests.test_permit_request.PrivateDemandsTest
stCase
We use Black as code formatter. Just use the following command to automatically format your code:
$ docker-compose exec web black .
We use django-extensions to show urls. Can be used to export models to a file (as text or picture), to display them in terminal and much more things
$ ./manage.py show_urls
- Create a geocity user
- Create a geocity schema owned by geocity user
- Edit DB connexion in .env file
- Create and edit pg_service.conf file in qgisserver directory
Edit the variables in .env
according to your environment.
Set the global environment switcher to ENV=DEV
in the .env
file.
Keep in mind that you are in a Docker environment. Thus you might need to set, on Linux environment something like:
PGHOST="172.17.0.1"
So that the Django container can reach your postgres
user on the host machine.
git clone git@github.com:yverdon/geocity.git && cd geocity
cp -n env.demo .env
docker-compose build
docker-compose down --remove-orphans && docker-compose up
Use your favorite webserver to proxypass localhost:9095 to the outside world
Administrator role (Django superuser): admin:admin
Backoffice role: secretariat-yverdon:admin
Validatation role A: validator-yverdon:admin
Validatation role B: eaux-yverdon:admin
The user belonging to backoffice group can be granted specific permissions:
see_private_requests
, "Voir les demandes restreintes": allows the user to make requests that are not visible by standard user. Typically during the setup stage of a new form configurationamend_permit_request
,"Traiter les demandes de permis": allow the user the process (amend) the requests (fill the backoffice fields), require validation for other departments and print the documentsvalidate_permit_request
,"Valider les demandes de permis": allow the user to fill the validation formclassify_permit_request
,"Classer les demandes de permis" allow the user to accept/reject the requests if validations services have all accepted it.edit_permit_request
, "Éditer les demandes de permis": allow the user to edit de requests filled by another person
Use docker-compose logs -f --tail=20 qgisserver
to see qgisserver logs
You can enable 2FA by setting the variable ENABLE_2FA
to true
. Defaults to false
.
Super users require to enable 2FA to have access to the admin app.
Follow the following steps:
- Go to the
/account/login/
and sign in with your super user credentials. - Follow the steps to activate 2FA
- Open
/admin/
Next time you sign in, you will be asked for a token.
Once you provided your token go to /admin/
to access the admin app.
Dependencies are managed with pip-tools
.
To install a new package, add it to requirements.in
, without pinning it to a
specific version unless needed. Then run:
docker-compose exec web pip-compile requirements.in
docker-compose exec web pip-compile requirements_dev.in
docker-compose exec web pip install -r requirements.txt
docker-compose exec web pip install -r requirements_dev.txt
Make sure you commit both the requirements.in
and the requirements.txt
files.
And the requirements_dev.in
and the requirements_dev.txt
files.
To upgrade all the packages to their latest available version, run:
docker-compose exec web pip-compile -U requirements.in
docker-compose exec web pip install -r requirements.txt
To upgrade only a specific package, use pip-compile -P <packagename>
.
The following commands will upgrade Django to its latest version, making sure
it's compatible with other packages listed in the requirements.in
file:
docker-compose exec web pip-compile -P django requirements.in
docker-compose exec web pip install -r requirements.txt
To run a migration, for example when the model has changed, execute
manage.py makemigrations
from inside the docker service of the web app.
Then execute manage.py migrate
.
docker-compose exec web python3 manage.py makemigrations <app_label>
docker-compose exec web python3 manage.py migrate <app_label> <migration_name>
For more information about django's migrations, help is available at:
docker-compose exec web python3 manage.py makemigrations --help
docker-compose exec web python3 manage.py migrate --help
Sidebar of wiki to show the new pages is managed by : github-wiki-sidebar.
Used _
instead of :
for Define the category separator
because the character was not allowed, the other params juste press enter and keep it has default.
? Define the category separator for multi-level menu: _
? Define the format of the page links: ./%s
? Define the _Sidebar.md content template: %s
? Select the items to be excluded from menu: (Press <space> to select, <a> to toggle all, <i> to invert selection)
? Change the priority/order of the items in menu <space separated list of ids - ex: 0 2 3>