我正在使用Aptana Studio中的Django Web应用程序,并且已经达到了通过Aptana调试非常好的程度。不幸的是,每当我尝试这样做时,我都会得到以下结果:
pydev debugger: starting
Traceback (most recent call last):
File "/home/zdurtschi/Documents/Aptana_Studio_3/plugins/org.python.pydev_3.0.0.1388187472/pysrc/pydevd.py", line 1479, in <module>
debugger.run(setup['file'], None, None)
File "/home/zdurtschi/Documents/Aptana_Studio_3/plugins/org.python.pydev_3.0.0.1388187472/pysrc/pydevd.py", line 1125, in run
pydev_imports.execfile(file, globals, locals) #execute the script
File "/home/zdurtschi/Workspaces/DjangoSite/zadWebApp/manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 261, in fetch_command
commands = get_commands()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 107, in get_commands
apps = settings.INSTALLED_APPS
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 54, in __getattr__
self._setup(name)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 49, in _setup
self._wrapped = Settings(settings_module)
File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__
% (self.SETTINGS_MODULE, e)
ImportError: Could not import settings 'zadWebApp.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named zadWebApp.settings
根据另一个问题的答案,我将以下内容添加到settings.py
:
DJANGO_SETTINGS_MODULE = 'zadWebApp.settings'
PYTHONPATH = "/home/user/Workspaces/DjangoSite/zadWebApp"
过去常常会出现一大堆错误,但是在上面的代码之间,添加了我的项目资源,还有其他一些东西,我已经把它归结为这个。我使用的是Aptana Studio 3.6和Django 1.6。在控制台中使用./manage.py runserver
可以正常运行。如果我可以提供任何其他有用的信息,我很乐意添加它。