0

I am unable to host a basic django project in IIS. I have been breaking my head over 2 days now and help would be greeeaaatly appreciated :).

I have enabled IIS, CGI, and others under the Application Development in IIS. This is my folder structure after creating a simple django project via the below command:

django-admin startproject dijky

Folder structure:

+ C:\inetpub\wwwroot
    + dijky
        + dijky
            - __init__.py
            - settings.py
            - urls.py
            - wsgi.py
        - manage.py
        - web.config
        - wfastcgi.py

I have copied the wfastcgi.py file into my project folder.

I have then Added a website named "dijky" with the below settings Add Website



Under the Machine name in IIS, Clicked on FastCGI Settings, and have given the Full path and Arguments as so: FastCGI settings



Then gave the environment variables as: FastCGI Properties - Environment Variables

I even tried setting the WSGI_HANDLER to dijky.wsgi.application, since the file C:\inetpub\wwwroot\dijky\dijky\wsgi.py has:

import os

from django.core.wsgi import get_wsgi_application

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dijky.settings")

application = get_wsgi_application()


Both don't work

My web.config XML file is:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <handlers>
            <add name="djangoappiis" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Users\xxxxxxx\Anaconda3\envs\djangy\python.exe|C:\inetpub\wwwroot\dijky\wfastcgi.py" resourceType="Unspecified" />
        </handlers>
    </system.webServer>
     <appSettings>
    <!-- Required settings -->
    <add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
    <add key="PYTHONPATH" value="C:\inetpub\wwwroot\dijky" />
    <add key="DJANGO_SETTINGS_MODULE" value="dijky.settings" />
    </appSettings>
</configuration>

After Starting the server I am not able to see the default django page that I we get on 127.0.0.1:8000. I tried localhost:8007 on my browser but get a 500 error.

Any experts out there who can help.

MagnumCodus
  • 171
  • 1
  • 11

1 Answers1

0

What's the detailed error message of 500 error?

Ididn't receive 500 error with your environment variables.

If you are receiving error An unknown FastCGI error occurred.

Please try to replace your application pool identity to local system. If it make your application work, then it should be a permission issue.

The last thing to you need to do is analyze permission with process monitor and grant permission for your application pool identity.

Jokies Ding
  • 3,374
  • 1
  • 5
  • 10