question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Django 1.9 fastcgi IIS fails

See original GitHub issue

I’ve published my Django application to IIS after upgrading Django installation locally , in my virtualenv, and on the server. I just finished migrating my application from Django 1.6 to 1.9 and in DEBUG everything seems to work fine. The published application fails to run:

Error occurred while reading WSGI handler:

Traceback (most recent call last):
  File "c:\python27\Lib\site-packages\wfastcgi.py", line 791, in main
    env, handler = read_wsgi_handler(response.physical_path)
  File "c:\python27\Lib\site-packages\wfastcgi.py", line 633, in read_wsgi_handler
    handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
  File "c:\python27\Lib\site-packages\wfastcgi.py", line 605, in get_wsgi_handler
    handler = handler()
  File ".\ptvs_virtualenv_proxy.py", line 102, in get_virtualenv_handler
    handler = get_wsgi_handler(os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
  File ".\ptvs_virtualenv_proxy.py", line 76, in get_wsgi_handler
    handler = getattr(handler, name)
AttributeError: 'module' object has no attribute 'wsgi'

Cant find the problem

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
JVanloofsveltcommented, Dec 15, 2017

I found the problem! My virtualenv contained files from an earlier version of Django because Publishing from Visual Studio did not delete remote files that no longer exist in my project’s virtualenv. I just enabled deleting of remote files in my publish config and then it worked.

1reaction
huguesvcommented, Dec 15, 2017

I vaguely recall the WSGI handler stuff changing at some point in a Django update?

I created a new django project, and the handler looks like: DjangoWebProject7.wsgi.application (as seen in DjangoWebProject7/settings.py)

And there’s a DjangoWebProject7/wsgi.py that looks like this:

import os

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

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

If your WSGI_HANDLER doesn’t look like that in your web.config or you don’t have a wsgi.py, then that would be the first thing to try.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Django on IIS 10 error 500.0
i am new with django and trying to install an application on IIS in ... FastCGI support is deprecated and will be removed...
Read more >
The FastCGI process exited unexpectedly - (Django iis ...
This is a FastCGI problem, I suggest you check the log on the python side, there should be detailed error messages. – samwu....
Read more >
Installing Django on IIS: A Step-by-Step Tutorial
Install the Tracing feature for IIS, then configure it for the Django site in Failed Request Tracing Rules to trace all content (),...
Read more >
Running a Django Application on Windows Server 2012 with IIS
Configure FastCGI in IIS · Open the IIS Manager by clicking the Windows button, clicking on Administrative Tools, and double-clicking Internet ...
Read more >
Django on IIS: Debugging IIS Error due to FastCGI request ...
I'm trying to host a Django web application on a windows 10 machine with IIS 10 with FastCGI. Whilst everything is running good...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found