2013-08-28 83 views
1
~/Documents/django1/mysite$ python manage.py syncdb 
Traceback (most recent call last): 

    File "manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 

    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 453, in execute_from_command_line 
    utility.execute() 

    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 392, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 

    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 263, in fetch_command 
    app_name = get_commands()[subcommand] 

    File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 109, in get_commands 
    apps = settings.INSTALLED_APPS 

    File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 53, in __getattr__ 
    self._setup(name) 

    File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 48, in _setup 
    self._wrapped = Settings(settings_module) 

    File "/usr/local/lib/python2.7/dist-packages/django/conf/__init__.py", line 132, in __init__ 
    mod = importlib.import_module(self.SETTINGS_MODULE) 

    File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module 
    __import__(name) 

    File "/home/nick/Documents/django1/mysite/mysite/settings.py", line 15 
    'NAME': '/home/nick/Documents/django1/sqlite.db' 

Settings.py試圖在你的字典<code>DATABASES</code>運行Django的教程執行syncdb並得到錯誤

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3' 
     'NAME': '/home/nick/Documents/django1/sqlite3.db' # The following settings are not used with sqlite3: 
     'USER': '', 
     'PASSWORD': '', 
     'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 
     'PORT': '', # Set to empty string for default. 
    } 
} 
    ^
+0

從'settings.py'顯示'DATABASES'字典。問題在那裏。 – alecxe

+0

我將它添加到上面的註釋中 – user2415453

回答

5

你缺少逗號(在ENGINENAME性損益後):

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3', 
     'NAME': '/home/nick/Documents/django1/sqlite3.db', # The following settings are not used with sqlite3: 
     'USER': '', 
     'PASSWORD': '', 
     'HOST': '', # Empty for localhost through domain sockets or '127.0.0.1' for localhost through TCP. 
     'PORT': '', # Set to empty string for default. 
    } 
} 
相關問題