【问题标题】:django core exceptions Improperly Configured:django核心异常配置不当:
【发布时间】:2014-11-12 15:02:36
【问题描述】:

django.core.exceptions.ImproperlyConfigured:

TEMPLATE_DIRS 设置必须是一个元组。请修正您的设置。

这是我的 settings.py 文件代码

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

  STATIC_URL = "/static/"
  ROOT_URLCONF = "%s.urls" % PROJECT_DIR
  TEMPLATE_DIRS = full_path("Home/Downloads/django-socketio-master/djangosocketio/templates")
  #LOGIN_URL = "/admin/"

【问题讨论】:

    标签: python-2.7 django-templates


    【解决方案1】:

    似乎提供给TEMPLATE_DIRS 的路径不正确。 您可以提供类似的路径

    import os
    PROJECT_PATH = os.path.dirname(os.path.realpath(__file__))
    
    TEMPLATE_DIRS = (os.path.join(PROJECT_PATH, '../templates'),)
    

    templates 是您的模板所在的目录。

    【讨论】:

      猜你喜欢
      • 2022-12-07
      • 1970-01-01
      • 1970-01-01
      • 2018-06-04
      • 2014-01-31
      • 1970-01-01
      • 1970-01-01
      • 2021-11-17
      • 2011-10-01
      相关资源
      最近更新 更多