[Django]-Django on IIS, process exited unexpectedly

2👍

I’ve spent lot of time to solve this problem and finally made it. I’ll share some tips that I’ve tried.

Environment

  • Windows Server 2012 R2
  • IIS 8.5 (CGI enabled)
  • python 3.6.6
  • wfastcgi 3.0.0

1. Folder permission

Since message FASTCGI_UNEXPECTED_EXIT showed up, IIS had permission to access folders ‘project folder’ and ‘virtualenv folder’

For those who only got 500 Error but no message, try granting folder permissions to IIS AppPool\<myapppoolname>

(Reference: https://support.pkware.com/display/SMAR/KB+-+Granting+folder+permissions+to+IIS+application+pools)

If you’re placing your under default AppPool, grant access to IUSR and IIS_IUSRS.

2. Install Python Properly

Reference: https://github.com/microsoft/PTVS/issues/5450

I used to install python under user folder instead of C:\Python36. So I removed and re-installed with executable installer downloaded from https://python.org/downloads

Some configurations:

  1. Add Python to Path
  2. Install for all users
  3. Location C:\Python36

Note that I am using virtual environment. But I know many tutorials don’t and they seems working fine, so feel free to use or not.

-3👍

I had the same issue, my solution was try to run your project locally,

python manage.py runserver

and see if you can run the project.
In my case, my numpy was broken, so it leads to the wfastcgi exited. Maybe your wfastcgi is perfect, but some other python packages are not working

Leave a comment