hokatvcu
hokatvcu

Reputation: 239

CSS is not showing on heroku django app

I'm having trouble showing my CSS/Static files on my django app I just deployed on Heroku. It doesn't show any debugging 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,
    )

Upvotes: 6

Views: 7108

Answers (2)

hokatvcu
hokatvcu

Reputation: 239

Used WhiteNoise to collectstaticfiles. Thanks for helping.

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

Upvotes: 10

Wtower
Wtower

Reputation: 19902

Try setting an absolute path to your STATIC_ROOT. From Django documentation: Settings:

STATIC_ROOT

The absolute path to the directory where collectstatic will collect static files for deployment.

Then make sure that you run collectstatic.

Last, I usually set STATICFILES_DIRS to None for deployment.

Upvotes: 0

Related Questions