我正在1.6版本上编写一个新的django项目但是当我去同步数据库时,settings.py会返回此错误:
mod = importlib.import_module(self.SETTINGS_MODULE)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/home/yabir/Documentos/python/project_vine/vine/vine/settings.py", line 29
ALLOWED_HOSTS = []
^
SyntaxError: invalid syntax
我在错误之前的settings.py
import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.6/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = '*******************'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
TEMPLATE_DEBUG = True
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates')
ALLOWED_HOSTS = []
答案 0 :(得分:3)
啊,你忘了关闭TEMPLATE_DIRS
。将其更改为:
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'), )
ALLOWED_HOSTS = []
答案 1 :(得分:3)
上一行中有一个错误的括号。它应该是:
TEMPLATE_DIRS = (os.path.join(BASE_DIR, 'templates'), )