Using Django with virtualenv, get error ImportErro

2020-04-08 11:10发布

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?

2条回答
小情绪 Triste *
2楼-- · 2020-04-08 11:39

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.

查看更多
Emotional °昔
3楼-- · 2020-04-08 11:57

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/

查看更多
登录 后发表回答