Serve static and media files by Django while in Debug mode

Feb 12, 2014 · Updated: Jul 12, 2021 · by Tim Kamanin

Media and static files won't be served in devel mode untill you put this at the end of the main file:

if settings.DEBUG:
    urlpatterns += patterns(
            {"document_root": settings.MEDIA_ROOT},
            {"document_root": settings.STATIC_ROOT},

Hey, if you've found this useful, please share the post to help other folks find it:

There's even more:

Subscribe for updates

  • via Twitter: @timonweb
  • old school RSS:
  • or evergreen email ↓ ↓ ↓