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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T04:06:59+00:00 2026-06-04T04:06:59+00:00

I am switching from the Django development server to Apache for production. To this

  • 0

I am switching from the Django development server to Apache for production. To this end, I installed modwsgi and specified the following in apache2.conf.

# Run my django application.
WSGIScriptAlias / /home/david/registration/registration/wsgi.py
WSGIPythonPath /home/david/registration

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

When I restart Apache, I find that my application loads in my browser, but none of the CSS or images do.

Previously, I had been using staticfiles to manage my static files. I had these settings.

# Absolute path to the directory static files should be collected to.
# Don't put anything in this directory yourself; store your static files
# in apps' "static/" subdirectories and in STATICFILES_DIRS.
# Example: "/home/media/media.lawrence.com/static/"
STATIC_ROOT = '/home/david/static/'

# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
STATIC_URL = '/static/'

The static files used to working, but not any more. Why does switching to Apache prevent my static files from loading?

  • 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-04T04:07:00+00:00Added an answer on June 4, 2026 at 4:07 am

    The best option for work with apache2 and wsgi and django is use a new file in /etc/apache2/sites-enabled/mynewsite.apache (the extension doesn´t matter)

    The file must look like this:

    NameVirtualHost *:80
    <VirtualHost *:80>
        ServerAdmin diego@diegue.us
        ServerName yourproject.com.co
        Alias /admin/media/ /path/to/your/admin/media/
        Alias /media/ /path/to/your/media/
        Alias /static/ /path/to/your/static/collected/files/
    
        <Directory /path/to/your/admin/media/>
            Order deny,allow
            Allow from all
        </Directory>
    
        <Directory /path/to/your/media/>
            Order deny,allow
            Allow from all
        </Directory>
    
        <Directory /path/to/your/static/collected/files/>
            Order deny,allow
            Allow from all
        </Directory>
    
        WSGIScriptReloading On
        WSGIDaemonProcess yourproject python-path=/path/of/packages/for/python # (this is because I use virtualenvwrapper)
        WSGIProcessGroup yourproject
        WSGIApplicationGroup yourproject
        WSGIPassAuthorization On
    
        WSGIScriptAlias / /path/to/your/yourproject.wsgi
        ErrorLog /var/log/apache2/yourproject-error.log
    
        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel debug
    
        CustomLog /var/log/apache2/yourproject-access.log combined
    
    </VirtualHost>
    

    You need to tell apache to serve your django application but also you need tell it that Apache serves the files.

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

Sidebar

Related Questions

I'm switching from SVN to Git with Gitosis installed on a central server for
I've seen a lot of posts about switching from php to Django but none
We are switching from a non-clustered to a 2-node clustered MSMQ Windows Server 2008
I'm switching from a windows server to a linux server and case sensitivity is
my project was not working properly when switching from my local development (sqlite3) to
I am using Django 1.3 in my project and switching away from the javascript
After switching from RVM to system ruby I keep getting this error. It doesn't
I am switching from log4j to SLF4j. I used SLF4J Migrator for this. Now
I'm switching from InProc session to SQL server session. Currently, my session object looks
I randomly keep getting this error when switching from Debug to Release when building

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.