forked from yverdon/geocity
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
## Setting up full Docker non persistent demo | ||
|
||
This will bring up a demo instance with preset fixtures served by the | ||
Django developpment server in reload mode. | ||
Django development server in reload mode. | ||
|
||
```bash | ||
git clone [email protected]:yverdon/geocity.git && cd geocity | ||
|
@@ -25,8 +25,15 @@ docker-compose run web python manage.py fixturize_demo | |
|
||
### Database | ||
|
||
1. Create a postgres database | ||
2. Install required extensions: postgis, pg_trgm, unaccent extension | ||
1. Create a PostgreSQL database | ||
2. Install required extensions: | ||
|
||
```sql | ||
CREATE EXTENSION postgis; | ||
CREATE EXTENSION pg_trgm; | ||
CREATE EXTENSION unaccent; | ||
``` | ||
|
||
3. Edit DB connection in .env file | ||
|
||
### Environment variables | ||
|
@@ -61,11 +68,11 @@ If you have `www.geocity.ch` as domain, you should put `geocity.ch` | |
DEFAULT_SITE=geocity.ch | ||
``` | ||
|
||
## Developpment tools | ||
## Development tools | ||
|
||
### Setup your Environment file | ||
|
||
Following variable setup in your .env file will setup the developpment environment for you | ||
Following variable setup in your .env file will setup the development environment for you | ||
|
||
```ini | ||
PRIVATE_DOCUMENTS_DIR=C:\some\directory\for\mounting\geocity\private_documents | ||
|
@@ -94,7 +101,7 @@ docker-compose stop web | |
docker-compose run --service-ports --name=web --rm --entrypoint="" web python manage.py test --settings=geocity.settings_test --keepdb geocity.tests.reports | ||
``` | ||
|
||
These tests compare generated PDFs to expected PDFs. To regenerated the expected images, you need to provide the following env var to the docker-compose run command `-e TEST_UPDATED_EXPECTED_IMAGES=TRUE`. By definition, when doing so, tests will succeed, so don't forget to manually review the changes to the files. | ||
These tests compare generated PDFs to expected PDFs. To regenerate the expected images, you need to provide the following env var to the docker-compose run command `-e TEST_UPDATED_EXPECTED_IMAGES=TRUE`. By definition, when doing so, tests will succeed, so don't forget to manually review the changes to the files. | ||
|
||
```bash | ||
docker-compose run --service-ports --name=web --rm --entrypoint="" -e TEST_UPDATED_EXPECTED_IMAGES=TRUE web python manage.py test --settings=geocity.settings_test --keepdb geocity.tests.reports | ||
|
@@ -132,7 +139,7 @@ We use [django-extensions](https://django-extensions.readthedocs.io/en/latest/co | |
### Testing emails | ||
|
||
A Mailhog container is working on the dev environment, you can access it by going to localhost:8025. | ||
Just ensure to setup the following entries in your .env file: | ||
Just ensure to setup the following entries in your `.env` file: | ||
|
||
```ini | ||
EMAIL_HOST=mailhog | ||
|
@@ -189,10 +196,10 @@ The user belonging to backoffice group can be granted specific permissions: | |
- `view_private_submission`, "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 configuration | ||
- `amend_submission`,"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 documents | ||
- `validate_submission`,"Valider les demandes de permis": allow the user to fill the validation form | ||
- `classify_submission`,"Classer les demandes de permis" allow the user to accept/reject the requests if validations services have all accepted it. | ||
- `classify_submission`,"Classer les demandes de permis" allow the user to accept/reject the requests if validations services have all accepted it | ||
- `edit_submission`, "Éditer les demandes de permis": allow the user to edit de requests filled by another person | ||
|
||
### Two factor authentification | ||
### Two factor authentication | ||
|
||
You can enable 2FA by setting the variable `ENABLE_2FA` to `true`. Defaults to `false`. | ||
|
||
|
@@ -202,7 +209,7 @@ Super users require to enable 2FA to have access to the admin app. | |
|
||
Follow the following steps: | ||
|
||
1. Go to the `/account/login/` and sign in with your super user credentials. | ||
1. Go to the `/account/login/` and sign in with your super user credentials | ||
2. Follow the steps to activate 2FA | ||
3. Open `/admin/` | ||
|
||
|
@@ -211,16 +218,16 @@ Once you provided your token go to `/admin/` to access the admin app. | |
|
||
### Locked failed logins | ||
|
||
Django-axes is used to limite login attemps from users. | ||
Django-axes is used to limit login attempts from users. | ||
Please read https://django-axes.readthedocs.io/en/latest/index.html to learn how to use it. | ||
|
||
### Geocity as a OAuth2 provider | ||
* [Access to a ressources with QGIS](docs/OAuth2_Qgis.md) | ||
* [Access to a ressources with a bearer token](docs/OAuth2_access_api.md) | ||
|
||
### Consuming OAuth2 providers | ||
You can login with a GEOMAPFISH account if you have one. | ||
* Create a SocialApp using the geomapfish provider. | ||
You can login with a GeoMapFish account if you have one. | ||
* Create a SocialApp using the GeoMapFish provider | ||
* Add the fields required for oauth2 process: | ||
|
||
``` | ||
|
@@ -230,8 +237,8 @@ key | |
certificate_key | ||
``` | ||
|
||
* Save the SocialApp, the GEOMAPFISH login is ready to use. | ||
* Don't create 2 SocialApp with the same provider. | ||
* Save the SocialApp, the GEOMAPFISH login is ready to use | ||
* Don't create 2 SocialApp with the same provider | ||
|
||
* Redirect URI configuration in oAuth provider for dev | ||
|
||
|
@@ -243,11 +250,11 @@ http://localhost:9095/geomapfish/login/callback/ | |
|
||
Create a setting `SOCIALACCOUNT_PROVIDERS["geomapfish"]["APP"]` containing a dict with the same keys, | ||
(`client_id`, `secret`, `key`, `certificate_key`). | ||
This will override the data of any SocialApp with provider geomapfish. | ||
This will override the data of any SocialApp with provider GeoMapFish. | ||
|
||
**Warning:** | ||
|
||
Geomapfish login process will raise an error if no APP settings and no SocialApp | ||
GeoMapFish login process will raise an error if no App settings and no SocialApp | ||
object are present. | ||
|
||
## Migrations | ||
|
@@ -261,14 +268,15 @@ 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: | ||
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 | ||
``` | ||
|
||
### Practical example | ||
|
||
Note: prepend `docker-compose exec web ` to the following python calls if your app is containerized. | ||
|
||
`<app_label>`: this is set automatically depending on which model file is modified. In Geocity, it will always be "permits" => so there is nothing to specify. | ||
|
@@ -282,7 +290,7 @@ Finally, you can apply it using: | |
|
||
Sidebar of wiki to show the new pages is managed by : [github-wiki-sidebar](https://www.npmjs.com/package/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. | ||
Used `_` instead of `:` for `Define the category separator` because the character was not allowed, the other parameters just press enter and keep it has default. | ||
|
||
```bash | ||
? Define the category separator for multi-level menu: _ | ||
|