Suivi des objets parlementaires
This applications requires:
- Backend: Python (v10), Django REST framework
- Frontend: Vite (v4)
Open a terminal in the directory of your app.
Move to back folder:
cd .\back\
- Create a new virtual environment and activate it.
python -m venv venv
venv\Scripts\activate
- Install requirements.
pip install -r requirements.txt
-
Copy the file
.env.template
to.env
and complete it with your configuration settings. -
Move to your backend server.
cd .\ne_sop_backend\
- Apply migrations.
python .\manage.py migrate
- Launch your backend server and test if it works.
python .\manage.py runserver
Then open http://127.0.0.1:8000/api/test in your browser, you should see "Congratulations! It works".
Are you starting with a new database? Then run this only once:
python manage.py loaddata entities.json entity-types.json items.json item-types.json item-status.json events.json event-types.json templates.json
In a new terminal, move to front directory and install
cd front
npm i
Run your server with vite.
vite
Open http://localhost:5173/web/sop/#/login in your browser. You should see the login page of your application.
Follow Installation steps.
In the back\ne_sop_backend
directory, collect static files by running:
python .\manage.py collectstatic
Add a first admin user by running:
python .\manage.py createsuperuser
Configure Apache if needed
Start by copying your env..template to env. and edit accordingly to your install.
Example:
cp env.production.template env.production
In your front
directory, run the following to create the dist
directory replacing by production or prepub:
npm i
npm run build -- --mode <instance>
All views are synthetised in a swagger which is based on the python drf.spectacular
library.
To create the schema.yml
file, activate your virtual environment, go into back\ne_sop_backend
and run:
python ./manage.py spectacular --color --file schema.yml
Then launch the service using the following command line:
docker run -p 80:8080 -e SWAGGER_JSON=/schema.yml -v ${PWD}/schema.yml:/schema.yml swaggerapi/swagger-ui
You can access the swagger using this url: http://127.0.0.1:8000/api/schema/docs/