The Python Oracle

Django Http404 and DEBUG mode catch 22

--------------------------------------------------
Hire the world's top talent on demand or became one of them at Toptal: https://topt.al/25cXVn
and get $2,000 discount on your first invoice
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Light Drops

--

Chapters
00:00 Django Http404 And Debug Mode Catch 22
00:45 Accepted Answer Score 3
01:20 Thank you

--

Full question
https://stackoverflow.com/questions/1093...

--

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.