Home:ALL Converter>Django global static files not loading

Django global static files not loading

Ask Time:2016-10-13T13:13:57         Author:jfk83

Json Formatter

I want to have global static files and templates for all my apps. My apps also will have templates and static files It will look something like this:

I am loading my global files like these but it is not working.

{% load staticfiles %}

href="{% static  'bootstrap/css/bootstrap.min.css' %}"

and I get:

"NetworkError: 500 Internal Server Error - http://localhost:8000/static/bootstrap/css/bootstrap.min.css"

By the way I can access to my apps static but not the global, I debug the STATIC_ROOT and PROJECT_ROOT and they seem good.

PROJECT_ROOT ='C:\\webpages\\client_portal\\client_portal'

projectname]/                  <- project root 
├── [projectname]/              <- Django root
│   ├── __init__.py
│   ├── settings/
│   ├── urls.py
│   └── wsgi.py
├── apps/
│   └── __init__.py
│
├── manage.py
│
├── static/
│   └── GLOBAL STATIC FILES
└── templates/
    └── GLOBAL TEMPLATES

My settings.py looks like this:

STATICFILES_STORAGE = 'whitenoise.django.GzipManifestStaticFilesStorage'

PROJECT_ROOT = os.path.dirname(os.path.abspath(__file__))

STATIC_ROOT = os.path.join(PROJECT_ROOT, '/static')
STATIC_URL = '/static/'

# Extra places for collectstatic to find static files.
STATICFILES_DIRS = (
    os.path.join(PROJECT_ROOT, '/static'),
)

Author:jfk83,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40012778/django-global-static-files-not-loading
Daniel Roseman :

STATIC_ROOT and STATICFILES_DIRS should not be the same. Create a different directory, eg staticfiles, to store your development static files and use that in STATICFILES_DIRS instead.",
2016-10-13T08:48:44
yy