Reputation: 2059
Having just switched my site to be served over SSL, I'm having trouble getting Django to pick up on the correct generated URL:s for static files.
My STATIC_URL
setting is in the form of https://example.com/assets/static/
When I do {% static 'css/file.css' %}
in a template, the path comes out as http://example.com/assets/static/css/file.css
— which is the same as before.
Things I've tried to remedy this:
python manage.py collectstatic
*.pyc
-files, just in caseThe same thing happens with MEDIA_URL
. However, if I drop into an interactive shell and import a model, and then print out the .url
property of an uploaded image file (for example), it comes out with the correct https://
-prefix.
Running Django 1.9.5, using CachedStaticFileLoader
for static files, Gunicorn (v 19.4), and template caching. Cache engine is memcached.
Any ideas on what's going on?
Edit: Settings changes for STATIC_URL
and MEDIA_URL
are not being picked up at all, it seems, although other code changes seem to work. I have not idea what's going on...
Upvotes: 4
Views: 1291
Reputation: 2059
The answer was that no settings changes were picked up at all – the Gunicorn process was hung up trying to restart somehow (no matter how many times I told it to), keeping the old process going. Changes to templates etc got picked up (as those are not python files), but the STATIC_URL
was never updated.
Stupidly simple answer: reboot ALL THE THINGS.
Upvotes: 2