2012-07-21 166 views
-2

我嘗試將應用程序添加到Django並將應用程序命名爲main。我輸入了django-admin.py startapp main。將應用程序添加到Django

當我運行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 

不知道如何解決這個錯誤......需要一些指導...

回答

3

不給應用程序與項目名稱相同; Django難以區分他們。

+0

謝謝...瞭解到我的錯誤... – lakesh 2012-07-21 16:51:53