I am attempting to set up a piece of software that runs on Python & Django. The instructions say to use the following command to generate an SQL database:
python manage.py migrate
However, when I do this, I receive the following error:
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
This seems to indicate that the problem is in line 116 of the 'settings.py' file, which I have below:
# 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 + (
)
Could someone help me understand how to fix this problem?
I'm not sure if it is relevant, but I am using Windows 7, Python 2.7, and Powershell to try to run this software.
Thank you in advance! If I have left any information out, please let me know and I will post it.