软件包安装后的“TemplateDoesNotExist”

时间:2015-06-24 11:51:11

标签: django

任何人都可以帮我找出原因吗?

我只是按照教程的结构,并将名为django-polls的软件包安装到名为mysite的项目中。但是在运行服务器之后它返回了“/在/ polls /上的TemplateDoesNotExist”。

以下是我所做的:

1.pip install /django-polls/dist/django-polls-0.1.tar.gz
2.modifed the settings.py in mysite project
3.modifed the urls.py in mysite project
4.python manage.py runserver
mysite项目中的

settings.py:

 ...
 TEMPLATE_DEBUG = True
 ...
# Application definition
INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'polls',
)
...
ROOT_URLCONF = 'mysite.urls'
...
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.7/howto/static-files/

STATIC_URL = '/static/'
TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [os.path.join(BASE_DIR, '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',
            ],
        },
    },
]

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader', # <--
)

0 个答案:

没有答案