Django Http404 and DEBUG mode catch 22
Become part of the top 3% of the developers by applying to Toptal https://topt.al/25cXVn
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Over a Mysterious Island Looping
--
Chapters
00:00 Question
01:05 Accepted answer (Score 3)
01:54 Thank you
--
Full question
https://stackoverflow.com/questions/1093...
Question links:
[the docs]: https://docs.djangoproject.com/en/dev/ho...
http://static.example.com/
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #httpstatuscode404
#avk47
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Over a Mysterious Island Looping
--
Chapters
00:00 Question
01:05 Accepted answer (Score 3)
01:54 Thank you
--
Full question
https://stackoverflow.com/questions/1093...
Question links:
[the docs]: https://docs.djangoproject.com/en/dev/ho...
http://static.example.com/
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #django #httpstatuscode404
#avk47
ACCEPTED ANSWER
Score 3
You can simply pretend you are in production. Run:
python manage.py collectstatic --noinput
To have all your files copied to STATIC_ROOT. Then, temporarily add the following to urls.py:
urlpatterns += patterns('',
(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
)
You'll have to run collectstatic each time you make a change to any static files, so I would suggest live-editing in something like Firebug and then saving the finished product. Also, remember to delete the static directory and remove that line from urls.py when you're done.