I'm using Python 2.7, Django 1.8 and apache server on my project. When I use DEBUG=True
, on my develop server, uploaded images viewed very well on template, but when DEBUG=False
, i get a 404 error. However static files work very well.
My setting.py look so:
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
STATICFILES_DIRS = (
os.path.join(BASE_DIR, 'static'),
)
STATIC_URL = '/static/'
The urls.py looks like on this post:
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
What i should change to make my media files work. Thanks.