我正在尝试设置一个运行在Python上的软件& Django。该说明说使用下面的命令来生成SQL数据库:接收错误:“TypeError:只能连接列表(而不是”元组“)到列表”
python manage.py migrate
然而,当我这样做,我收到以下错误:
python : Traceback (most recent call last):
At line:1 char:1
+ python manage.py migrate
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Traceback (most recent call last)::String)
[], RemoteException+ FullyQualifiedErrorId : NativeCommandError
File "manage.py", line 10, in execute_from_command_line(sys.argv) File "C:\Python27\lib\site-packages\django\core\management__init__.py", line 353, in execute_from_command_line utility.execute()
File "C:\Python27\lib\site-packages\django\core\management__init__.py", line 302, in execute settings.INSTALLED_APPS
File "C:\Python27\lib\site-packages\django\conf__init__.py", line 55, in getattr self._setup(name)
File "C:\Python27\lib\site-packages\django\conf__init__.py", line 43, in _setup self._wrapped = Settings(settings_module)
File "C:\Python27\lib\site-packages\django\conf__init__.py", line 99, in init mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Python27\lib\importlib__init__.py", line 37, in import_module import(name)
File "F:\directory\settings.py", line 117, in TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
TypeError: can only concatenate list (not "tuple") to list
这似乎表明,问题在一行中的“settings.py”文件的116,我有如下:
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
import os
from django.conf import global_settings
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/
# SECURITY WARNING: don't run with debug turned on in production!
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',
'game',
'admin_views',
)
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',
'django.middleware.security.SecurityMiddleware',
)
ROOT_URLCONF = 'cagweb.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'game/templates/')],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
]
WSGI_APPLICATION = 'cagweb.wsgi.application'
# Database
# https://docs.djangoproject.com/en/1.8/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
}
}
# Internationalization
# https://docs.djangoproject.com/en/1.8/topics/i18n/
LANGUAGE_CODE = 'en-us'
#LANGUAGE_CODE = 'fr'
LOCALE_PATHS = (
os.path.join(BASE_DIR, 'locale'),
)
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.8/howto/static-files/
STATICFILES_DIRS = (
os.path.join(BASE_DIR, "static"),
)
STATIC_URL = '/static/'
TEMPLATE_CONTEXT_PROCESSORS = global_settings.TEMPLATE_CONTEXT_PROCESSORS + (
)
有人能帮助我了解如何解决这个问题?
我不确定它是否相关,但我正在使用Windows 7,Python 2.7和Powershell来尝试运行此软件。
预先感谢您!如果我留下了任何信息,请让我知道,我会发布它。
亲爱@ozgur - 非常感谢你!这似乎已经工作:) – Yasha