[Fixed]-Django collectstatic and Apache issue


First, change your STATIC_URL to: '/static/'. That should be URL on what Apache serves your static files, not system directory path.

Second, remove DocumentRoot from your apache config. All files outside of static directories should be handled by wsgi.

Third, change:

<Directory /home/jacobian/apps/apps/>
   Order allow,deny
   Allow from all
   Options -Indexes


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

You don’t want to serve all your files, just wsgi.py should be accessed publicly, and handled by WSGI. Also try to move that block below WSGIScriptAlias.

Fourth, remove trailing slash at the end of path in <Directory /home/jacobian/apps/apps/>.

Fifth, change allow,deny to deny,allow.

Leave a comment