Django on Heroku - Broken Admin Static Files

前端 未结 9 665
天命终不由人
天命终不由人 2020-12-24 14:37

I have a Django app running on Heroku/Cedar, configured as per the instructions at https://devcenter.heroku.com/articles/django

Using gunicorn as per Heroku\'s instr

9条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-24 15:28

    Check out this post: http://matthewphiong.com/managing-django-static-files-on-heroku

    If that doesn't work for you try adding the following to your urls.py after the normal url pattern tuple. Make sure you have your STATIC_ROOT set and you've run collect static on your local environment all before pushing to heroku.

    urlpatterns += patterns('',
        url(r'^static/(?P.*)$', 'django.views.static.serve', {
            'document_root': settings.STATIC_ROOT,
        }),
     )
    

提交回复
热议问题