Issue
I want to access logs easily on my app so I created a page for that, I click on a button and it download the log. But I get a 404 error when I try to do that, I've set static files and media files
here are my settings
STATIC_URL = 'static/'
STATICFILES_DIRS = [
"frontend/static",
]
MEDIA_URL = 'media/'
MEDIA_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'media')
LOG_URL = 'static/logs/'
LOG_ROOT = os.path.join(os.path.dirname(BASE_DIR), 'static/logs')
and here are my urls
urlpatterns += static(settings.LOG_URL, document_root = settings.LOG_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
It works when I access /media/path/to/media.file, but not for /static/logs/path/to/logs.txt, it's the same configuration for both urls so I know I miss a point, but how could I fix it? Is it because I used static and not media? Thx a lot
Solution
It depends how you deployed your Django application? Better add media/log folder path while serving application on the web.
Answered By - Ajay K
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.