Understanding and Resolving WSGI Application Not Found Error

Hi everyone,

I’m new to Django and have recently set up my first project. While attempting to deploy my Django application using Apache and mod_wsgi, I encountered the following error message:

Target WSGI script '/path/to/myproject/wsgi.py' does not contain WSGI application 'application'

This error has been a roadblock in getting my site up and running, and despite searching through various resources, I haven’t been able to resolve it. Here’s the setup I followed:

  1. Project Structure:

        ├── myproject/
        │   ├── __init__.py
        │   ├── settings.py
        │   ├── urls.py
        │   └── wsgi.py
        ├── manage.py
        └── app/
            ├── __init__.py
            ├── models.py
            ├── views.py
            └── ...
  2. Apache Configuration:

    <VirtualHost *:80>
        ServerAdmin admin@example.com
        ServerName example.com
        ServerAlias www.example.com
        DocumentRoot /path/to/myproject
        WSGIScriptAlias / /path/to/myproject/myproject/wsgi.py
        <Directory /path/to/myproject/myproject>
            <Files wsgi.py>
                Require all granted
        Alias /static /path/to/myproject/static
        <Directory /path/to/myproject/static>
            Require all granted
        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
  3. wsgi.py File:

    import os
    from django.core.wsgi import get_wsgi_application
    os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'myproject.settings')
    application = get_wsgi_application()

Troubleshooting Steps I’ve Taken:

  • Verified that the DJANGO_SETTINGS_MODULE is correctly pointing to myproject.settings.
  • Ensured that wsgi.py is correctly placed in the project directory.
  • Checked that all necessary permissions are set for the project directory and files.
  • Restarted the Apache server multiple times after making configuration changes.

Despite these efforts, the error persists. I suspect that there might be a misconfiguration or a missing step that I have overlooked. I would appreciate any guidance or suggestions on how to resolve this issue.


  1. Could there be an issue with how my project directory is structured?
  2. Are there any additional configurations needed in the wsgi.py file?
  3. Have I missed any crucial steps in setting up the Apache configuration?

Idioms Thank you in advance for your help!
Looking forward to your insights!

Best regards,

Welcome @modismos !

First, I suggest you use the real file contents involved here and not try to edit them. (e.g., use the real directories instead of trying to anonymizing them by using names like /path/to/.) This avoids having to go back-and-forth to correct typos that may occur. Using the real names also sometimes reveal other issues that may not otherwise be obvious.


Keep in mind that Apache needs to walk the complete directory tree starting from root (/) in order to locate these files. Setting up these projects in /home directories generally ends up being problematic as a result. My recommendation is that projects get deployed to something in /var/www or /opt to ensure no issues are created by the use of higher-level directories.

Side note: I don’t see any configuration for either a virtual environment or for using it in daemon mode. I always recommend both of these as part of any deployment. (While I consider them important, I don’t believe either of these would be causing this specific issue. I suggest you do them both, but as a general practice and not as an attempt to get this deployment up-and-running.)