While creating python file on IIS with django Error 500

1

When I try to create a Python file (.py) in my Django application, I get an error 500. The file is created, and the code isn't the problem. I can create a text file or any other format. It would need to be a Python file because I need it for further steps.

I am using Windows 10 and running the Django application on IIS. Windows, IIS and Django are all up-to-date.

I already tried to add permission to the folder I will edit. I tested around with some other settings but haven't figured out the problem yet. I think it should be something with permission of IIS or Django.

This is my error message:

d:\django\virtualenv0\scripts\python.exe - The FastCGI process exited unexpectedly

Most likely causes:
IIS received the request; however, an internal error occurred during the processing of the request. The root cause of this error depends on which module handles the request and what was happening in the worker process when this error occurred.
IIS was not able to access the web.config file for the Web site or application. This can occur if the NTFS permissions are set incorrectly.
IIS was not able to process configuration for the Web site or application.
The authenticated user does not have permission to use this DLL.
The request is mapped to a managed handler but the .NET Extensibility Feature is not installed.

Things you can try:
Ensure that the NTFS permissions for the web.config file are correct and allow access to the Web server's machine account.
Check the event logs to see if any additional information was logged.
Verify the permissions for the DLL.
Install the .NET Extensibility feature if the request is mapped to a managed handler.
Create a tracing rule to track failed requests for this HTTP status code. For more information about creating a tracing rule for failed requests, click here.

Detailed Error Information:
Module     FastCgiModule
Notification       ExecuteRequestHandler
Handler    Python FastCGI
Error Code     0x00000000
Requested URL      https://alpha.truningerag.ch:443/projects/realtest/
Physical Path      D:\django\projects\realtest\
Logon Method       Anonymous
Logon User     Anonymous

More Information:
This error means that there was a problem while processing the request. The request was received by the Web server, but during processing a fatal error occurred, causing the 500 error.
View more information »

Microsoft Knowledge Base Articles:

294807
python
django
iis
asked on Stack Overflow Aug 5, 2019 by Patrick Lüthi • edited Aug 5, 2019 by aschultz

2 Answers

1

you need to check some below settings:

1)you enable iis CGI feature.

2)ensure pip and setup tools are fully upgraded:

python -m pip install pip --upgrade && pip install setuptools --upgrade

3)install the virtualenv tool:

pip install virtualenv

4)Activate the virtualenv so all our commands affect this interpreter.

C:\inetpub\wwwroot\mydjangoproject\> venv\scripts\activate

5)Configured the WFast CGI in iis.

6)"d:\django\virtualenv0\" path has iis_iusrs and iusr full control permission.

7)check iis application pool identity which server Django project.

for more detail, you could refer this link.

and please share your web.config file for more detail about the issue.

answered on Stack Overflow Aug 6, 2019 by Jalpa Panchal
1

I was able to solve my problem. I switch from IIS to Apache which didnt had any problem with creating a .py file anymore. After that I got an empty models file. The only thing left to do was to add in the absolute path python in the os.system(command).

Now everything works fine.

answered on Stack Overflow Aug 8, 2019 by Patrick Lüthi

User contributions licensed under CC BY-SA 3.0