Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8367463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:09:53+00:00 2026-06-09T13:09:53+00:00

I have a django web application running on our apache2 production server using mod_python

  • 0

I have a django web application running on our apache2 production server using mod_python, but no static files are found (css,images … )

All our static stuff is under /var/my.site/example/static

/var/my.site/example/static/
                           |-admin/
                                  |-css/
                                  |-img/     
                           |-css/
                           |-js/
                           |-img/

Now I thought I just could alias all requests to my static stuff like so:

This is the apache2 conf:

<VirtualHost  123.123.123:443>
    ... SSL stuff ...
    RewriteEngine On    
    ReWriteOptions Inherit 
    <Location "/example">
        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

    </Location>

    Alias /example/static /var/my.site/example/static    
    <Directory /var/my.site/example/static>
        Order allow,deny
        Allow from all
    </Directory>

</VirtualHost>

This is my settings.py

...
STATIC_ROOT = '/var/my.site'
STATIC_URL = '/example/static/'
STATICFILES_DIRS = (
    "/var/my.site/example/static",
)
...

There is no errors in the apache-error log. But here log from apache-secure_access.log

[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

But this doesn’t work and I’m not sure, if I even, is on the right track. It does work when I set DEBUG = True But that’s just because django serves all the static files.

What am I doing wrong?

Does anyone know about a good tutorial or example?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:09:54+00:00Added an answer on June 9, 2026 at 1:09 pm

    After @supervacuo suggestion that I strip down everything from django, I got apache to serve the static files and realized what was wrong.

    The problem was that <Location "/example"> got priority over Alias /example/static. It didn’t matter where I put the Alias (above or below the <Location> - tag).

    To fix it I changed the STATIC_URL and STATIC_ROOT, than I could change the Alias not to interfere with the <Location> - tag

    From:

    STATIC_ROOT = '/var/my.site'
    STATIC_URL = '/example/static/'
    
    Alias /example/static /var/my.site/example/static
    

    To:

    STATIC_ROOT = '/var/my.site/example'
    STATIC_URL = '/static/'
    
    Alias /static /var/my.site/example/static   
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a simple live chat into a web application running on Django, but
I only have one VPS hosting and using nginx for Django web application. Now,
I'm developping a web application using google appengine and django, but I think my
I have a django application hosted on a server running on Apache + Ubuntu.
I have an HTML form in my Django web application (NOT implemented using Django
In our web application (django based, with solr backend) we have some checkboxes with
I have a web application built in Django 1.3. We have also provided API
I have a web application build in Django + Python that interact with web
I have a reviews/ratings web application, a la Digg. My django app content has
I'm new to Django and Web programming in general. Have googled but could not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.