2014-07-16 90 views
2

您好我是很新的Django和我一直保持打字時的「manage.py執行syncdb」Django的manage.py執行syncdb錯誤

Traceback (most recent call last): 
    File "C:\Users\B3dog\Desktop\MyWebsite\mysite\manage.py", line 10, in <module> 

    execute_from_command_line(sys.argv) 
    File "C:\Python34\lib\site-packages\django-1.8-py3.4.egg\django\core\managemen 
t\__init__.py", line 330, in execute_from_command_line`enter code here` 
    utility.execute() 
    File "C:\Python34\lib\site-packages\django-1.8-py3.4.egg\django\core\managemen 
t\__init__.py", line 304, in execute 
    django.setup() 
    File "C:\Python34\lib\site-packages\django-1.8-py3.4.egg\django\__init__.py", 
line 21, in setup 
    apps.populate(settings.INSTALLED_APPS) 
    File "C:\Python34\lib\site-packages\django-1.8-py3.4.egg\django\apps\registry. 
py", line 89, in populate 
    "duplicates: %s" % app_config.label) 
django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, d 
uplicates: admin 

我使用Python 3.4得到這個錯誤在我的命令提示符。 1和使用django.get_version()發現的Django版本1.8。我知道有關於此的stackoverflow上的答案,但我沒有發現我沒有找到最新的答案。

編輯:我忘了,包括我的settings.py

""" 
Django settings for mysite project. 

For more information on this file, see 
https://docs.djangoproject.com/en/dev/topics/settings/ 

For the full list of settings and their values, see 
https://docs.djangoproject.com/en/dev/ref/settings/ 
""" 

# Build paths inside the project like this: os.path.join(BASE_DIR, ...) 
import os 
BASE_DIR = os.path.dirname(os.path.dirname(__file__)) 


# Quick-start development settings - unsuitable for production 
# See https://docs.djangoproject.com/en/dev/howto/deployment/checklist/ 

# SECURITY WARNING: keep the secret key used in production secret! 
SECRET_KEY = 'pl=&jot_vf_([email protected]^[email protected](up76otxwqm3wj3)x' 

# SECURITY WARNING: don't run with debug turned on in production! 
DEBUG = True 

TEMPLATE_DEBUG = True 

ALLOWED_HOSTS = [] 


# Application definition 

INSTALLED_APPS = (
    'django.contrib.admin', 
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'django.contrib.admin', 
) 

MIDDLEWARE_CLASSES = (
    'django.contrib.sessions.middleware.SessionMiddleware', 
    'django.middleware.common.CommonMiddleware', 
    'django.middleware.csrf.CsrfViewMiddleware', 
    'django.contrib.auth.middleware.AuthenticationMiddleware', 
    'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 
    'django.contrib.messages.middleware.MessageMiddleware', 
    'django.middleware.clickjacking.XFrameOptionsMiddleware', 
) 

ROOT_URLCONF = 'mysite.urls' 

WSGI_APPLICATION = 'mysite.wsgi.application' 


# Database 
# https://docs.djangoproject.com/en/dev/ref/settings/#databases 

DATABASES = { 
    'default': { 
     'ENGINE': 'django.db.backends.sqlite3', 
     'NAME': 'mysite.db', 
    } 
} 

# Internationalization 
# https://docs.djangoproject.com/en/dev/topics/i18n/ 

LANGUAGE_CODE = 'en-us' 

TIME_ZONE = 'UTC' 

USE_I18N = True 

USE_L10N = True 

USE_TZ = True 


# Static files (CSS, JavaScript, Images) 
# https://docs.djangoproject.com/en/dev/howto/static-files/ 

STATIC_URL = '/static/' 

回答

4

你有內部INSTALLED_APPSdjango.contrib.admin兩個條目。這裏的固定版本:

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.messages', 
    'django.contrib.staticfiles', 
    'django.contrib.admin', 
) 
+1

你爲什麼是天才。像你這樣能看到這些東西的人就是上帝。 – b3dog

+1

@ b3dog謝謝,但它實際上只是跟蹤回溯提供的信息,並瞭解一些關於django設置的細節。這並不困難。你與Django合作的越多,你會看到的越多,你就會越享受框架:) – alecxe

+0

Django 1.8? 1.7甚至不穩定 – Alvaro

相關問題