From 9e000737fd172aa6fb4bbe16d0c9c7c11491a8c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Paulo=20Nunes=20Soares?= Date: Sun, 3 Dec 2017 13:17:58 -0200 Subject: [PATCH] #221 - Correcting collecting static files when debug is false --- init.sh | 2 ++ medical_prescription/medical_prescription/urls.py | 9 +++++---- .../templates/{erro404.html => 404.html} | 1 + 3 files changed, 8 insertions(+), 4 deletions(-) rename medical_prescription/templates/{erro404.html => 404.html} (98%) diff --git a/init.sh b/init.sh index 5ae75cbf..7618d974 100755 --- a/init.sh +++ b/init.sh @@ -25,6 +25,8 @@ python3 medical_prescription/manage.py makemigrations python3 medical_prescription/manage.py migrate echo "Load all datas" python3 medical_prescription/manage.py loaddata data2.json +echo "Collecting static" +python3 medical_prescription/manage.py collectstatic echo "Run server" python3 medical_prescription/manage.py runserver 0.0.0.0:8000 & . ./node_modules/.bin/gulp default diff --git a/medical_prescription/medical_prescription/urls.py b/medical_prescription/medical_prescription/urls.py index f3b1903d..39f18d87 100644 --- a/medical_prescription/medical_prescription/urls.py +++ b/medical_prescription/medical_prescription/urls.py @@ -47,7 +47,8 @@ def protected_serve(request, path, document_root=None, show_indexes=False): url(r'^$', home, name='landing_page'), ) -if settings.DEBUG: - urlpatterns += [ - url(r'^', TemplateResponse, {'template': 'erro404.html'}), - ] +# if settings.DEBUG: +# urlpatterns += [ +# (r'^media/(?P.*)$', 'django.views.static.serve', +# {'document_root': settings.MEDIA_ROOT, 'show_indexes': True,}) +# ] diff --git a/medical_prescription/templates/erro404.html b/medical_prescription/templates/404.html similarity index 98% rename from medical_prescription/templates/erro404.html rename to medical_prescription/templates/404.html index 29bf215f..761a407e 100644 --- a/medical_prescription/templates/erro404.html +++ b/medical_prescription/templates/404.html @@ -179,6 +179,7 @@