0

I made a web page using Django and uploaded it in Heroku. I've encountered some minor setback on loading the css, js files in heroku for a while, now I've already fixed them(css/js are now loaded). Now the issue that I have encountered is that when updating my navbar styles in my scss file and compiled without any errors(local) and the changes I've made are showing.

Now I've pushed my changes to my heroku app, it doesn't change at all. I've researched about the problem and took some of the solution but it doesn't work.

In my local:

enter image description here

In my prod:

enter image description here

Here is my production.py:

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))
STATIC_ROOT = os.path.join(PROJECT_ROOT, 'staticfiles')
STATIC_URL = '/static/'

STATICFILES_DIRS = (
    os.path.join(PROJECT_ROOT, 'static'),
 )
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

My wsgi.py:

from django.core.wsgi import get_wsgi_application
from whitenoise.django import DjangoWhiteNoise

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings.production")

application = get_wsgi_application()
application = DjangoWhiteNoise(application)

I've followed this: https://devcenter.heroku.com/articles/django-assets#collectstatic-during-builds

and also Two-scoops-of-Django-1.11 for best practices.

3
  • Open your browser's console, see if you have the right path for your css file. Commented Nov 4, 2017 at 5:43
  • Every file paths are correct. Commented Nov 4, 2017 at 7:26
  • I've found the solution. Commented Nov 4, 2017 at 7:34

1 Answer 1

1

I've found the problem, clearing the cache in my development and prod and pushing the commit fixed my issue. Just in case someone has problems like this that every build(new design, style, etc..).

Try clearing the cache first then collectstatic in your development workstation then clear cache in heroku, push the new commits. Then collectstatic in heroku if collecstatic is disabled(you can enable automatic collectstatic). Restart heroku, changes will appear.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.