Django IIS Deployment - HTTP Error 404.0 - Not Found

I need explanation on how to deploy Django Application on Windows IIS Server.

I am struggling to follow the following tutorial

I have a project which looks like this :

[My_App]
--> [My_App_Venv]
--> [abcd]
    |-> manage.py
    |-> [abcd]
        |->  settings.py
        |-> [static]
        |-> ...

[ example ] is used to represent folders

I Need to understand how I should setup my IIS website :

What should be FastCGI Application settings

Full Path :

C:\xxxxx\My_App\My_App_Venv\Scripts\python.exe

Arguments :

C:\xxxxx\My_App\My_App_Venv\Lib\site-packages\wfastcgi.py

Environment Variables :

 1. DJANGO_SETTINGS_MODULE : abcd.settings             (I think this is ok)
 2. PYTHONPATH             : C:\xxxxx\My_App           (I am not sure about this)
 3. WSGI_HANDLER           : abcd.wsgi.application     (I think this is ok)

Create and Configure a New IIS Web Site

what should be the physical Path ?

C:\xxxxx\My_App ? 
C:\xxxxx\My_App\abcd ? 
C:\xxxxx\My_App\abcd\abcd ? 

Configure the mapping module ## (which i assume is correct)

Request path: *
Module: FastCgiModule
Executable : C:\xxxxx\My_App\My_App_Venv\Scripts\python.exe|C:\xxxxx\My_App\My_App_Venv\Lib\site-packages\wfastcgi.py
Name  : Django Handler

output

enter image description here

Hope someone can help to understand what I am doing wrong, I might use wrong path somewhere.

Note : When I do By hand :

cd C:/xxxxx/My_App/My_App_Venv
.\\scripts\Activate
cd..
cd abcd
python manage.py runserver

The website is well displayed on : http://127.0.0.1:8000/

There are many reasons for this error, you can try the following methods to solve the problem:

  1. Changing the Application Pool from Classic to Integrated fixed the issue.
  2. Try removing and adding the service back in IIS.

If the problem still cannot be solved, try using failed request tracing to see details about 404 error, this will generate detail log file, which will help you to identify the problem.

Back to Top