1

I am following this tutorial to hosting my django application on windows IIS Manager. After following all steps from the tutorial I have got the following HTTP Error 500.0 - Internal Server Error

Is there any way to solve the issue?? I didn't find any solution for this...

I am using,

Python==3.10.0  
Django==3.2.8  
wfastcgi==3.0.0  
IIS 10.0.17763.1
iku
  • 133
  • 2
  • 9
  • This is a FastCGI problem, I suggest you check the log on the python side, there should be detailed error messages. – samwu Oct 29 '21 at 07:05
  • How to check the log? – iku Oct 29 '21 at 14:16
  • You can find IIS server logs by clicking on your site under 'Sites', double-clicking on 'Logging', and clicking on 'View Log Files...' under 'Actions' in the right panel. You can add Django logging by defining it in your settings file and ensuring the logfile has proper permissions I recommend starting with example #3: logging to a file in the django docs ( https://docs.djangoproject.com/en/3.2/topics/logging/#examples ). When I had your problem, however, the IIS logs weren't helpful and the requests weren't reaching Django to be logged. – Ryan Feb 11 '22 at 00:47

1 Answers1

2

I had this same issue (Error code 0x00000067) and have been beating my head against a wall for 24 hours. I am new to Windows servers, but have been deploying Django Apps on Linux servers for over a decade.

In my case, I had deviated from the Johnnyboycurtis tutorial you referenced in a few ways:

  • I tried to install every python package in a virtual environment
  • I did not install Python at C:\, but rather hidden under my user's AppData\local\Programs\Python dir (the default)

I am assuming that your app works when running the Django Development server (py manage.py runserver -> http://localhost:8000 ) your app looks as expected (when DEBUG = True in settings.py)

Fixing my code install meant taking the following steps:

  • Navigating to C:\Users\MyUserName\AppData\local\Programs\Python, and following Johnnyboycurtis' instructions (but on Python310 instead of Python37) I added permissions for my AppPool to run Python.
  • I had to install wfastcgi OUTSIDE of my virtual environment:
    • deactivate (if you have a python virtual environment activated)
    • py -m pip install wfastcgi

Note that I did NOT have to change any other settings that were assuming my virtual environment:

  • web.config: 'scriptProcessor' still points to a python.exe and wfastcgi.py inside my virtual environment
  • IIS FastCGI Settings 'Full Path' and 'Arguments' both refer to files in my virtual environment
Dharman
  • 30,962
  • 25
  • 85
  • 135
Ryan
  • 463
  • 4
  • 14
  • Also note that the Microsoft Documentation that Johnnyboycurtis refers to encourages you to not use Virtual Environments: https://learn.microsoft.com/en-us/visualstudio/python/configure-web-apps-for-iis-windows?view=vs-2019#install-packages – Ryan Feb 11 '22 at 00:54
  • I had the same issue and resolved it by allowing the IIS user access to python'[s global and non-global environmental folder – Jelani May 07 '23 at 00:29