Reputation: 79
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:
In my prod:
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.
Upvotes: 0
Views: 451
Reputation: 79
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.
Upvotes: 1