diff --git a/entrypoint.sh b/entrypoint.sh index f22cc81..dea42a9 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -8,7 +8,20 @@ python manage.py loaddata initial nginx if [ "$TFJM_STAGE" = "prod" ]; then - gunicorn -b 0.0.0.0:8000 --workers=2 --threads=4 --worker-class=gthread tfjm.wsgi --access-logfile '-' --error-logfile '-'; +gunicorn -b 0.0.0.0:8000 \ + --workers=2 \ + --threads=4 \ + --worker-class=uvicorn.workers.UvicornWorker \ + tfjm.asgi \ + --access-logfile '-' \ + --error-logfile '-' else - python manage.py runserver 0.0.0.0:8000; +gunicorn -b 0.0.0.0:8000 \ + --workers=2 \ + --threads=4 \ + --worker-class=uvicorn.workers.UvicornWorker \ + tfjm.asgi \ + --access-logfile '-' \ + --error-logfile '-' \ + --reload fi diff --git a/requirements.txt b/requirements.txt index 7270b06..067ca8d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -20,4 +20,5 @@ ipython~=8.5.0 python-magic~=0.4.26 requests~=2.28.1 sympasoap~=1.1 +uvicorn~=0.17 whoosh~=2.7 \ No newline at end of file diff --git a/tfjm/urls.py b/tfjm/urls.py index 7c041b3..767b5ca 100644 --- a/tfjm/urls.py +++ b/tfjm/urls.py @@ -21,6 +21,7 @@ from django.contrib import admin from django.urls import include, path from django.views.defaults import bad_request, page_not_found, permission_denied, server_error from django.views.generic import TemplateView + from participation.views import MotivationLetterView from registration.views import HealthSheetView, ParentalAuthorizationView, PhotoAuthorizationView, \ ScholarshipView, SolutionView, SynthesisView, VaccineSheetView @@ -64,6 +65,11 @@ if 'cas_server' in settings.INSTALLED_APPS: # pragma: no cover path('cas/', include('cas_server.urls', namespace="cas_server")), ] +if settings.DEBUG: + # Serve static files in DEBUG mode + import django.contrib.staticfiles.urls + urlpatterns += django.contrib.staticfiles.urls.urlpatterns + handler400 = bad_request handler403 = permission_denied handler404 = page_not_found