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 6618177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T20:47:47+00:00 2026-05-25T20:47:47+00:00

I have a site I made with Django, and I’m trying to deploy it

  • 0

I have a site I made with Django, and I’m trying to deploy it on an Apache server I have lying around (using mod_wsgi as recommended by the official docs) and for the most part, everything’s going great. I am having a problem getting Apache to correctly serve the static files associated with my project. Judging by comparing the source of the rendered HTML with my server’s file structure, I would say that my app is requesting the right files from the right locations, but for whatever reason Apache throws me a 404. Here’s my config for apache:

<VirtualHost *:80>
    ServerName book
    ServerAlias www.book.dev book.dev

    DocumentRoot /var/www/book


    Alias   /static/        /var/www/book/static
    Alias   /media/         /var/www/book/media

    <Directory /var/www/book/static>
            Order deny,allow
            Allow from all
    </Directory>

    WSGIScriptAlias / /home/rich/sites/book/apache/django.wsgi

    <Directory /home/rich/sites/book>
            Order allow,deny
            Allow from all
    </Directory>

</VirtualHost>

If I navigate to STATIC_ROOT in my web browser (in this case www.book.dev/static) I see a (correct) listing of the first level in the directory structure on the server. However, trying to follow the links to sub-directories, or even files in the root directory, yields only a 404. I’m using Django 1.3, Python 2.6, and some version of apache in the 2.X range (whatever is the most recent version in debian’s package repo)

Any help is appreciated.

EDIT: (The plot thickens!)

So, after fiddling some more, I found something that I thought was interesting. I discovered that if I run the development server, the URL’s from which static content is fetched are identical to the static file URL’s which are generated when Apache is serving the files. This is to say, they all take the form /static/<file> as configured in settings.py, but sometimes it doesn’t work.

  • 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-05-25T20:47:48+00:00Added an answer on May 25, 2026 at 8:47 pm

    Try having:

    Alias   /static/        /var/www/book/static/
    Alias   /media/         /var/www/book/media/
    

    If using trailing slashes for a sub URL, the target file system path should have a trailing slash as well.

    Compare to documentation at:

    http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#Hosting_Of_Static_Files

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(I have to deal with this awful vendor site made for IE6) I'm trying
I have a site I made using jsp's and I need to stylize it.
I have this custom made site using Jekyll: http://madhur.github.com/ When I view this site
I have a Django site and I am trying to set a cookie in
I have a site I made really fast that uses floats to display different
I have made a site with classic php and mysql functions. I order to
Hi I made this site a while ago in my table days but have
I currently have a community site that I run that is made up of
Post-release, I have made one small change to one form in our development site
I have and old django site (0.97-pre-SVN-7457) and I'm about to make some changes

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.