From 469e62e70891a37ec4016fcd025f979859074ef7 Mon Sep 17 00:00:00 2001 From: neodarz Date: Fri, 26 Apr 2019 11:34:19 +0200 Subject: Add moooore cheat --- cheat/.cheat/django | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'cheat/.cheat/django') diff --git a/cheat/.cheat/django b/cheat/.cheat/django index ebb5817..97efafc 100644 --- a/cheat/.cheat/django +++ b/cheat/.cheat/django @@ -29,3 +29,22 @@ django-admin makemessages -l fr # compil translations files django-admin compilemessages + +# Pour tester avec debug=False et manage.py runserver +source : https://stackoverflow.com/a/49722734 + +In urls.py I added this line: + +``` +from django.views.static import serve +``` + +add those two urls in urlpatterns: + +``` +url(r'^media/(?P.*)$', serve,{'document_root': settings.MEDIA_ROOT}), +url(r'^static/(?P.*)$', serve,{'document_root': settings.STATIC_ROOT}), +``` + +and both static and media files were accesible when DEBUG=FALSE. +Hope it helps :) -- cgit v1.2.1