Heroku - Handling static files in Django app Heroku - Handling static files in Django app django django

Heroku - Handling static files in Django app


I found a solution. This was my initial myapp/urls.py:

from django.conf.urls.defaults import patterns, include, urlfrom django.contrib import adminfrom django.conf import settingsadmin.autodiscover()urlpatterns = patterns('',    url(r'^$', include('myapp.cesar.urls')),    url(r'^admin/', include(admin.site.urls)),)

I added these lines to the end of the original myapp/urls.py file:

if not settings.DEBUG:    urlpatterns += patterns('',        (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),    )

Now it's working fine. I hope this helps someone else too


Probably you should manually create empty STATIC_ROOT folder specified in you settings before running './manage.py collectstatic'.