max*_*mus 10 python eclipse django pydev
我安装了eclipse indigo和pydev以及python 32.
我已经配置了我的python路径,可以创建一个"空"的django项目:

但是,当我右键单击项目并运行as-> pydev:django时
我明白了:
Traceback (most recent call last):
File "C:\Users\djangoworkspace\test3\src\manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 443, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "C:\Python27\lib\site-packages\django\utils\importlib.py", line 35, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\django\core\management\commands\runserver.py", line 8, in <module>
from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application
File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 26, in <module>
from django.views import static
File "C:\Python27\lib\site-packages\django\views\static.py", line 95, in <module>
template_translatable = ugettext_noop(u"Index of %(directory)s")
File "C:\Python27\lib\site-packages\django\utils\translation\__init__.py", line 75, in gettext_noop
return _trans.gettext_noop(message)
File "C:\Python27\lib\site-packages\django\utils\translation\__init__.py", line 48, in __getattr__
if settings.USE_I18N:
File "C:\Python27\lib\site-packages\django\utils\functional.py", line 184, in inner
self._setup()
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "C:\Python27\lib\site-packages\django\conf\__init__.py", line 95, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'C:\Python27\Lib\site-packages\django\conf\project_template\settings.py' (Is it on sys.path?): Import by filename is not supported.
Run Code Online (Sandbox Code Playgroud)
知道我在eclipse中运行django项目需要解决的问题吗?
请务必按照http://pydev.org/manual_adv_django.html中的步骤操作
该项目必须在PyDev中标记为Django项目.
DJANGO_MANAGE_LOCATION字符串替换变量必须指向manage.py的项目相对位置.
DJANGO_SETTINGS_MODULE字符串替换变量必须包含该项目中的设置模块的名称.
DJANGO_SETTINGS_MODULE实际上是python模块名称,而不是特定文件.所以你的DJANGO_SETTINGS_MODULE应该是'project_template.settings'
右键单击该项目,然后选择"Pydev-Django"和以下内容
如果你看到如上图所示的消息"模块:xxsetting可以找到",那么将此项目添加到python路径,如下所示
右键单击该项目,然后选择Pydev - PYTHONPATH
现在添加了python项目
现在一切都很好:)注意:这是使用django 1.10和pydev 5.2制作的
| 归档时间: |
|
| 查看次数: |
5537 次 |
| 最近记录: |