Eclipse中的Django Shell无法启动

时间:2016-12-29 18:12:57

标签: django eclipse pydev django-shell

当我尝试从Eclipse Neon运行shell时,我收到此错误消息,而我可以从命令窗口成功运行Django shell。我使用的是Python 3.4和Django 1.10。知道问题在哪里吗?

enter image description here

WSGI文件:

'''
WSGI config for MyProject project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.10/howto/deployment/wsgi/
'''

import os
from django.core.wsgi import get_wsgi_application

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

application = get_wsgi_application()

1 个答案:

答案 0 :(得分:2)

我相信这是Eclipse Pydev中的已知错误。

https://www.brainwy.com/tracker/PyDev

  

固定为5.6

     

Git:2c8cd03 2017-03-12 Fabio Zadrozny#PyDev-752:Django版本没有   如果>检测到1.10

已经发布了修复程序。

您可以尝试正常启动python shell,然后:

import sys; print('%s %s' % (sys.executable or sys.platform, sys.version))
import os; os.environ['DJANGO_SETTINGS_MODULE'] = '<Project Name>.settings'; import django
sys.path.append(os.path.expanduser('<path to your project>'))
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

将“项目名称”替换为项目名称和“项目路径”,并附上路径

或者,使用前1.10版本的Django即1.7