0
我已經使用pip在OS X 10.9.5上安裝了django,並且一切都運行良好。我在第二天解僱了它,這個工具似乎被打破了。Django管理工具損壞?
現在,除了「startproject」之外的任何命令都會失敗,並顯示以下輸出。我試過開始一個完全乾淨的項目,而且我也得到了同樣的東西。
$ django-admin manage.py check
Traceback (most recent call last):
File "/usr/local/bin/django-admin", line 11, in <module>
sys.exit(execute_from_command_line())
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 330, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Library/Python/2.7/site-packages/django/core/management/__init__.py", line 182, in fetch_command
settings.INSTALLED_APPS
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 48, in __getattr__
self._setup(name)
File "/Library/Python/2.7/site-packages/django/conf/__init__.py", line 42, in _setup
% (desc, ENVIRONMENT_VARIABLE))
django.core.exceptions.ImproperlyConfigured: Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
不知道它是如何有幫助的是,因爲這是一個新的項目,但這裏是從manage.py輸出:
#!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "testdjango.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)
我試着卸載/重新安裝Django的。我應該在哪裏看下?
啊男人,看起來像我是「盯着它太久了」的受害者!謝謝 :) – DougW