CSS not showing in heroku django app

I am having trouble showing my CSS / Static files in my django app that I just deployed to Heroku. It doesn't show any debug errors, so I don't know where to start.

Here is my code:

SETTINGS_DIR = os.path.dirname(__file__)
PROJECT_PATH = os.path.join(SETTINGS_DIR, os.pardir)
PROJECT_PATH = os.path.abspath(PROJECT_PATH)

STATIC_PATH = os.path.join(PROJECT_PATH, 'static')
STATIC_ROOT = 'staticfiles'
STATIC_URL = '/static/'
STATICFILES_DIRS = (
    STATIC_PATH,
    )

      

+3


source to share


2 answers


Used by WhiteNoise to collect static files. Thanks for the help.



https://devcenter.heroku.com/articles/django-assets for documentation.

+3


source


Try to set an absolute path to yours STATIC_ROOT

. From Django Documentation: Settings :

STATIC_ROOT

The absolute path to the directory where collectstatic

static files will be collected for deployment.



Then make sure you run collectstatic

.

Finally, I usually install STATICFILES_DIRS

in None

for deployment.

0


source







All Articles