我尝试将应用程序添加到 Django 并将应用程序命名为 main。我输入了 django-admin.py startapp main。
当我运行 python manage.py runserver 时,我遇到了这个错误:
Traceback (most recent call last):
File "manage.py", line 14, in <module>
execute_manager(settings)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 459, in execute_manager
utility.execute()
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
klass = load_command_class(app_name, subcommand)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
module = import_module('%s.management.commands.%s' % (app_name, name))
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 8, in <module>
from django.core.management.sql import custom_sql_for_model, emit_post_sync_signal
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/core/management/sql.py", line 6, in <module>
from django.db import models
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/db/__init__.py", line 11, in <module>
if DEFAULT_DB_ALIAS not in settings.DATABASES:
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
self._setup()
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/site-packages/django/conf/__init__.py", line 42, in _setup
self._wrapped = Settings(settings_module)
File "/Users/cnnlakshmen_2000/Projects/env/lib/python2.7/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 'main.settings' (Is it on sys.path?): No module named settings
不知道如何解决错误...需要一些指导...