NoseTests のドキュメントは非常に簡単に見えますが、初期設定に関する答えはどこにも見つかりません。pip install nodestests を実行しましたが、うまくいきましたが、django プロジェクトのルートに「nosetests」と入力すると、次のようになります。
ERROR: Failure: ImproperlyConfigured (Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/nose/loader.py", line 413, in loadTestsFromName
addr.filename, addr.module)
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/nose/importer.py", line 47, in importFromPath
return self.importFromDir(dir_path, fqname)
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/nose/importer.py", line 94, in importFromDir
mod = load_module(part_fqname, fh, filename, desc)
File "/Users/aronchick/Code/ayafi/pages/tests.py", line 1, in <module>
from django.test import TestCase
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/django/test/__init__.py", line 5, in <module>
from django.test.client import Client, RequestFactory
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/django/test/client.py", line 21, in <module>
from django.db import close_connection
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/django/db/__init__.py", line 11, in <module>
if settings.DATABASES and DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 53, in __getattr__
self._setup(name)
File "/Users/aronchick/Code/ayafi/venv/lib/python2.7/site-packages/django/conf/__init__.py", line 46, in _setup
% (desc, ENVIRONMENT_VARIABLE))
ImproperlyConfigured: Requested setting DATABASES, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.
明らかに、Djangoアプリ全体で設定を取得していませんが、その理由は明らかではありません-python manage.pyサーバーまたはフォアマンを使用して、アプリをローカルで正常に実行できます。私は何を取りこぼしたか?