heroku / django-heroku

[DEPRECATED] Do not use! See https://github.com/heroku/django-heroku/issues/56
BSD 3-Clause "New" or "Revised" License
459 stars 142 forks source link

django_heroku overwrites my STATIC_URL setting of my S3 bucket. #25

Open NamanJn opened 5 years ago

NamanJn commented 5 years ago

Not sure if I'm missing anything but when I set my STATIC_URL to my s3 bucket, STATIC_URL changes back to '/static/'.

Line 96 of core.py in django_heroku is where the STATIC_URL is reset.

Is this a bug or am I just missing something?

tyrion commented 5 years ago

If you want to handle the configuration of static files yourself I think you should pass staticfiles=False when calling django_heroku.settings in your settings.py:

django_heroku.settings(locals(), staticfiles=False)

Make sure you are then defining all the other options as well (STATIC_ROOT, STATICFILES_STORAGE etc).

mudgil commented 5 years ago

Spent two very frustrating days because Heroku documentation does not highlight this. Documentation says that django_heroku.settings(locals()) should be at the end of the settings.py file. How's one to know that that's where STATIC_URL suddenly takes a new value and storage becomes 'whitenoise..... Anyway, thanks tyrion, your suggestion works.