我正在尝试让 Django 使用 virtualenv 工作。我已经在线获得了 hello world 页面。但是,现在似乎出了点问题,因为我的大多数命令都给了我关于 myProject.settings 的相同错误
(myenv)user@mint /opt/myenv/myProject $ python manage.py startapp polls
Traceback (most recent call last):
File "manage.py", line 13, in <module>
execute_from_command_line(sys.argv)
File "/opt/myenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 453, in execute_from_command_line
utility.execute()
File "/opt/myenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/myenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 263, in fetch_command
app_name = get_commands()[subcommand]
File "/opt/myenv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 109, in get_commands
apps = settings.INSTALLED_APPS
File "/opt/myenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/opt/myenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 48, in _setup
self._wrapped = Settings(settings_module)
File "/opt/myenv/local/lib/python2.7/site-packages/django/conf/__init__.py", line 134, in __init__
raise ImportError("Could not import settings '%s' (Is it on sys.path?): %s" % (self.SETTINGS_MODULE, e))
ImportError: Could not import settings 'myProject.settings' (Is it on sys.path?): No module named myProject.settings
(myenv)user@mint /opt/myenv/myProject $