Until yesterday I was working quietly on the /media/
route in DEV, and went to do a deploy for production and a production dump for my environment to match, and started to give that problem. I also had to add new features of several branches, so something happened that I can not identify. Currently my settings look like this:
urls.py:
if settings.DEBUG:
# static files (images, css, javascript, etc.)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
settings.py
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, "media")
STATIC_ROOT = os.path.join(BASE_DIR, "public")
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
os.path.join(BASE_DIR, 'media'),
)
But I get a 302 every time I load an image or file that's in the media. Worse, it redirects to the main route /
[23/Aug/2017 14:55:35] "GET /media/product/teste.png HTTP/1.1" 302 0
[23/Aug/2017 14:55:35] "GET / HTTP/1.1" 200 16764