gpt4 book ai didi

python - 在eclipse中通过pydev集成django?

转载 作者:太空狗 更新时间:2023-10-29 18:25:49 24 4
gpt4 key购买 nike

我已经安装了 eclipse indigo 和 pydev 以及 python 32。

我已经配置了我的 python 路径并且可以创建一个“空的”django 项目:

enter image description here

但是,当我运行右键单击项目并运行 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.

知道我需要修复什么才能在 Eclipse 中运行 Django 项目吗?

最佳答案

请务必按照 http://pydev.org/manual_adv_django.html 中的这些步骤进行操作

  1. The project must be marked as a Django project inside of PyDev.

  2. A DJANGO_MANAGE_LOCATION string substitution variable must point to the project-relative location of manage.py.

  3. A DJANGO_SETTINGS_MODULE string substitution variable must contain the name of the settings module in that project.

DJANGO_SETTINGS_MODULE 实际上是 python 模块名,而不是具体的文件。所以你的 DJANGO_SETTINGS_MODULE 应该是 'project_template.settings'

关于python - 在eclipse中通过pydev集成django?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14014829/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com