diff options
author | neodarz <neodarz@neodarz.net> | 2019-04-26 11:34:19 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-04-26 11:34:19 +0200 |
commit | 469e62e70891a37ec4016fcd025f979859074ef7 (patch) | |
tree | 690faf01abd10b7d6721d4e46b5dcbfd0727efb3 /cheat/.cheat/django | |
parent | 537e727f43311bc30d93c9af645dde3450605129 (diff) | |
download | dotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.tar.xz dotfiles_ascii-469e62e70891a37ec4016fcd025f979859074ef7.zip |
Add moooore cheat
Diffstat (limited to 'cheat/.cheat/django')
-rw-r--r-- | cheat/.cheat/django | 19 |
1 files changed, 19 insertions, 0 deletions
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<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}), +url(r'^static/(?P<path>.*)$', serve,{'document_root': settings.STATIC_ROOT}), +``` + +and both static and media files were accesible when DEBUG=FALSE. +Hope it helps :) |