Note that there are some explanatory texts on larger screens.

plurals
  1. POHow make apache serve static files to django
    primarykey
    data
    text
    <p>I have a django web application running on our <strong>apache2</strong> production server using <strong>mod_python</strong>, but no static files are found (css,images ... )</p> <p>All our static stuff is under <code>/var/my.site/example/static</code></p> <pre><code>/var/my.site/example/static/ |-admin/ |-css/ |-img/ |-css/ |-js/ |-img/ </code></pre> <p>Now I thought I just could alias all requests to my static stuff like so:</p> <p>This is the apache2 conf:</p> <pre><code>&lt;VirtualHost 123.123.123:443&gt; ... SSL stuff ... RewriteEngine On ReWriteOptions Inherit &lt;Location "/example"&gt; SetHandler python-program PythonHandler django.core.handlers.modpython SetEnv DJANGO_SETTINGS_MODULE example.settings PythonPath "[ \ '/home/me/Envs/ex/lib/python2.6/site-packages',\ '/var/my.site',\ '/home/me/Envs/ex/lib/python2.6/site-packages/django',\ '/home/me/Envs/ex/lib/python2.6/site-packages/MySQLdb',\ '/var/my.site/example',\ '/var/my.site/example/static'] + sys.path" PythonDebug Off &lt;/Location&gt; Alias /example/static /var/my.site/example/static &lt;Directory /var/my.site/example/static&gt; Order allow,deny Allow from all &lt;/Directory&gt; &lt;/VirtualHost&gt; </code></pre> <p>This is my settings.py</p> <pre><code>... STATIC_ROOT = '/var/my.site' STATIC_URL = '/example/static/' STATICFILES_DIRS = ( "/var/my.site/example/static", ) ... </code></pre> <p>There is no errors in the apache-error log. But here log from apache-secure_access.log</p> <pre><code>[09/Aug/2012:12:37:55 +0200] "GET /example/admin/ HTTP/1.1" 200 6694 [09/Aug/2012:12:37:55 +0200] "GET /example/static/css/base.css HTTP/1.1" 301 468 [09/Aug/2012:12:37:55 +0200] "GET /example/static/img/logo.png HTTP/1.1" 403 766 [09/Aug/2012:12:37:55 +0200] "GET /example/static/css/base.css/ HTTP/1.1" 500 756 [09/Aug/2012:12:37:55 +0200] "GET /example/static/admin/css/dashboard.css HTTP/1.1" 301 622 </code></pre> <p>But this doesn't work and I'm not sure, if I even, is on the right track. It does work when I set <code>DEBUG = True</code> But that's just because django serves all the static files.</p> <p><strong>What am I doing wrong?</strong></p> <p><strong>Does anyone know about a good tutorial or example?</strong> </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload