0
votes

I went to this route http://127.0.0.1:8000/static/corefiles/chatbot-data.xlsx but i get Page not found (404) error...

I added those to the URLs:

+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

File directory is /rootproject/core/static/corefiles/testexel.xlsx

My settings.py :

STATIC_URL = '/static/'

STATICFILES_DIRS = ( normpath(join(BASE_DIR, 'static')), normpath(join(BASE_DIR, 'upload')), )

STATIC_ROOT = normpath(join(BASE_DIR, 'assets'))

1

1 Answers

1
votes

Static files are to be used in your project, if you need to view a document at the specified url, you need to specify media url and media root in the settings:

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

Also add those to the URLs:

 + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)