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

匿名 (未验证) 提交于 2019-12-03 02:31:01

问题:

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?

回答1:

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.



回答2:

I think this module was removed in Django 1.9

The documentation for this module in version 1.8 says that will be removed in 1.9: https://docs.djangoproject.com/en/1.8/howto/deployment/fastcgi/



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!