...
 
Commits (4)
......@@ -25,7 +25,7 @@ __Else :__
- CMD : python manage.py loaddata dump.json
- CMD : python manage.py runserver
At this point, the server is running on localhost:8000. Try to make a request with your browser.
Then try to make a request with your front app STARTED ON PORT 3000.
Then try to make a request with your front app STARTED ON PORT 3000.
## Routes
......@@ -38,10 +38,18 @@ Then try to make a request with your front app STARTED ON PORT 3000.
* /observedwaitingtime ->POST Ajout d'un nouveau temps observé (attention au JSON envoyé)
* /incidentreport ->POST Ajout d'une nouvelle déclaration incident (attion au JSON envoyé)
## To Test the server
- Open a shell in the django project root directory (which contains a file manage.py)
- CMD : python -W ignore manage.py test saclaze_back.tests
## Routines
__Be sure to run the following commands every day at least:__
- CMD : python manage.py startwtf (it refresh the historical average)
"""
To use this command, run (in manage.py folder):
- python manage.py startwtf
"""
from django.core.management.base import BaseCommand
from saclaze_back.waitingtimefactory import WaitingTimeFactory
class Command(BaseCommand):
help = 'Launch the WaitingTimeFactory to refresh historical average waiting times.'
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
self.stdout.write(self.style.WARNING(
'Please wait, the compute can take some time (about 5 sec).'))
wtf = WaitingTimeFactory()
wtf.estimate_all_locations()
self.stdout.write(self.style.SUCCESS(
'Successfully refreshed all historical average.'))