[Answered ]-Can not find CSS file path in Django on Apache with mod_wsgi

2👍

✅

You should do something like.

Alias /static/ /path/to/your/STATIC_ROOT/directory/

<Directory /path/to/your/STATIC_ROOT/directory>
    Require all granted
</Directory>

in httpd.conf,
You should run ./manage.py collectstatic so that all your static files + django admin static files are collected in STATIC_ROOT directory.

then open up your main urls.py and add these lines at the end

from settings import STATIC_ROOT
if conf.DEBUG == True:
    urlpatterns = patterns('',
        url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': STATIC_ROOT}),
    ) + urlpatterns

add these lines to your settings.py

STATICFILES_DIRS = (
    os.path.join(PROJECT_ROOT, 'polls/static'),
)

and also go through the docs.

I hope things will work now.

Leave a comment