Django - resource was not found on this server on production
I am trying to access these files used from the django-import-export-celery
module:
I am able to see my view on local:
But its not showing on my production server:
This is my urlpattern
:
urlpatterns = static(
settings.MEDIA_URL, document_root=settings.MEDIA_ROOT
) + [
# favicon
path('favicon.ico', RedirectView.as_view(url=staticfiles_storage.url('img/Dalmore-Group-16-16.png'))),
# debug
path('__debug__/', include(debug_toolbar.urls)),
url(r'^', admin.site.urls),
]
And my settings.py
has:
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
I added this:
location /media/ {
root /home/ubuntu/dalmoreportal;
}
in /etc/nginx/sites-available/django.conf