[Answer]-Unable to use admin's static file when debug is False in django

1👍

You need to set up a web server to serve the static files. If you are using Apache, adding something along the lines of

Alias /static/ /home/user/djangoproject/djangoapp/static/
<Directory /home/user/djangoproject/djangoapp/static>
        Order deny,allow
        Allow from all
</Directory>

to httpd.conf should do the trick. For more info see https://docs.djangoproject.com/en/1.6/howto/static-files/deployment/

To serve also the Django project through Apache, add

WSGIScriptAlias / /home/user/djangoproject/djangoproject/wsgi.py
WSGIPythonPath /home/user/djangoproject

<Directory /home/user/djangoproject/djangoproject>
  <Files wsgi.py>
    Order deny,allow
    Allow from all
  </Files>
</Directory>

Alias /static/ /home/user/djangoproject/djangoapp/static/
<Directory /home/user/djangoproject/djangoapp/static>
  Order deny,allow
  Allow from all
</Directory>

to httpd.conf. For instructions about how to set up Django with Apache, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/modwsgi/

👤skoll

Leave a comment