Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Django with virtualenv, get error ImportError: No module named 'django.core.servers.fastcgi'

I'm using virtualenv and trying to host my django app. I'm using Python 3.5 and Django 1.9.2. I can run import django fine. When I run

from django.core.servers.fastcgi import runfastcgi

I get the error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'django.core.servers.fastcgi'

My Path:

['', '/home/wrapupne/venv/lib/python35.zip', '/home/wrapupne/venv/lib/python3.5', '/home/wrapupne/venv/lib/python3.5/plat-linux', '/home/wrapupne/venv/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5', '/usr/local/lib/python3.5/plat-linux', '/home/wrapupne/venv/lib/python3.5/site-packages']

Any ideas?

like image 209
gmccoy Avatar asked Feb 18 '16 02:02

gmccoy


1 Answers

FastCGI support was deprecated in 1.7, and the module you're trying to import was removed in 1.9. The only protocol supported by Django in 1.9 is WSGI.

If, for some reason, you cannot use WSGI directly, you need to use an adapter that can serve a WSGI application as FastCGI.

like image 136
knbk Avatar answered Sep 28 '22 05:09

knbk