mercredi 23 octobre 2019

Unable to load static files in Django Production

I am trying to run the app with DEBUG=False

Below is my setting file configuration

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(file)))

STATIC_URL = '/static/'

STATICFILES_DIRS = [os.path.join(BASE_DIR, "static/")]

STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles/')

After running python manage.py collectstatic, all the static files in the app path are copied to staticfiles directory (mentioned in STATIC_ROOT path).

When loading the webpage, the static files are failed to get load.

Error message:

GET /static/dist/bootstrap-4.0.0-dist/js/bootstrap.min.14d449eb8876.js HTTP/1.1" 404 77

GET /static/dist/bootstrap-select/js/bootstrap-select.min.31f649694651.js HTTP/1.1" 404 77

GET /static/js/base.1332bbb46ac5.js HTTP/1.1" 404 77

GET /static/crsummary/dist/amcharts4/core.ea1ec0eb6727.js HTTP/1.1" 404 77

Looking at the error message, apps is trying to load the bootstrap.min.14d449eb8876.js from path /static/*/* but the actual file location is staticfiles/*/*

I am not sure what configuration that I have missed out here. Please help




Aucun commentaire:

Enregistrer un commentaire