,我有是,这是我的项目树中的问题:模板文件夹无法识别数字海洋
django_project
|-- circuitos
| |-- admin.py
| |-- apps.py
| |-- __init__.py
| |-- migrations
| | |-- 0001_initial.py
| | |-- 0002_auto_20161031_1107.py
| | |-- 0003_circuito_imagen_trazado.py
| | |-- 0004_circuito_fecha_evento.py
| | |-- 0005_auto_20161111_1025.py
| | |-- 0006_auto_20161111_1026.py
| | |-- 0007_auto_20161111_1028.py
| | |-- 0008_auto_20161111_1133.py
| | |-- __init__.py
| | `-- __pycache__
| | |-- 0001_initial.cpython-35.pyc
| | |-- 0002_auto_20161031_1107.cpython-35.pyc
| | |-- 0003_circuito_imagen_trazado.cpython-35.pyc
| | |-- 0004_circuito_fecha_evento.cpython-35.pyc
| | |-- 0005_auto_20161111_1025.cpython-35.pyc
| | |-- 0006_auto_20161111_1026.cpython-35.pyc
| | |-- 0007_auto_20161111_1028.cpython-35.pyc
| | |-- 0008_auto_20161111_1133.cpython-35.pyc
| | `-- __init__.cpython-35.pyc
| |-- models.py
| |-- __pycache__
| | |-- admin.cpython-35.pyc
| | |-- __init__.cpython-35.pyc
| | |-- models.cpython-35.pyc
| | |-- urls.cpython-35.pyc
| | `-- views.cpython-35.pyc
| |-- tests.py
| |-- urls.py
| `-- views.py
|-- django_project
| |-- __init__.py
| |-- __init__.pyc
| |-- settings.py
| |-- settings.pyc
| |-- settings.pye
| |-- urls.py
| |-- urls.pyc
| |-- wsgi.py
| `-- wsgi.pyc
|-- equipos
| |-- admin.py
| |-- apps.py
| |-- __init__.py
| |-- migrations
| | |-- 0001_initial.py
| | |-- 0002_remove_equipo_slug.py
| | |-- 0003_equipo_imagen_equipo.py
| | |-- __init__.py
| | `-- __pycache__
| | |-- 0001_initial.cpython-35.pyc
| | |-- 0002_remove_equipo_slug.cpython-35.pyc
| | |-- 0003_equipo_imagen_equipo.cpython-35.pyc
| | `-- __init__.cpython-35.pyc
| |-- models.py
| |-- __pycache__
| | |-- admin.cpython-35.pyc
| | |-- __init__.cpython-35.pyc
| | |-- models.cpython-35.pyc
| | |-- urls.cpython-35.pyc
| | `-- views.cpython-35.pyc
| |-- tests.py
| |-- urls.py
| `-- views.py
|-- manage.py
|-- media
|-- noticias
| |-- admin.py
| |-- apps.py
| |-- __init__.py
| |-- management
| | |-- commands
| | | |-- __init__.py
| | | |-- __init__.pyc
| | | |-- __pycache__
| | | | |-- __init__.cpython-35.pyc
| | | | `-- script.cpython-35.pyc
| | | `-- script.py
| | |-- __init__.py
| | |-- __init__.pyc
| | `-- __pycache__
| | `-- __init__.cpython-35.pyc
| |-- migrations
| | |-- 0001_initial.py
| | |-- 0002_noticia_fecha_noticia.py
| | |-- 0003_auto_20161111_1127.py
| | |-- 0004_auto_20161111_1133.py
| | |-- 0005_auto_20161111_1133.py
| | |-- __init__.py
| | `-- __pycache__
| | |-- 0001_initial.cpython-35.pyc
| | |-- 0002_noticia_fecha_noticia.cpython-35.pyc
| | |-- 0003_auto_20161111_1127.cpython-35.pyc
| | |-- 0004_auto_20161111_1133.cpython-35.pyc
| | |-- 0005_auto_20161111_1133.cpython-35.pyc
| | `-- __init__.cpython-35.pyc
| |-- models.py
| |-- __pycache__
| | |-- admin.cpython-35.pyc
| | |-- __init__.cpython-35.pyc
| | |-- models.cpython-35.pyc
| | |-- urls.cpython-35.pyc
| | `-- views.cpython-35.pyc
| |-- tests.py
| |-- urls.py
| `-- views.py
|-- pilotos
| |-- admin.py
| |-- apps.py
| |-- __init__.py
| |-- migrations
| | |-- 0001_initial.py
| | |-- 0002_auto_20161030_1237.py
| | |-- 0003_auto_20161111_1037.py
| | |-- 0004_auto_20161111_1133.py
| | |-- __init__.py
| | `-- __pycache__
| | |-- 0001_initial.cpython-35.pyc
| | |-- 0002_auto_20161030_1237.cpython-35.pyc
| | |-- 0003_auto_20161111_1037.cpython-35.pyc
| | |-- 0004_auto_20161111_1133.cpython-35.pyc
| | `-- __init__.cpython-35.pyc
| |-- models.py
| |-- __pycache__
| | |-- admin.cpython-35.pyc
| | |-- __init__.cpython-35.pyc
| | |-- models.cpython-35.pyc
| | |-- urls.cpython-35.pyc
| | `-- views.cpython-35.pyc
| |-- tests.py
| |-- urls.py
| `-- views.py
|-- static
| |-- css
| | `-- base.css
| `-- js
| `-- base.js
`-- templates
|-- base.html
|-- circuitos
| |-- circuito_confirm_delete.html
| |-- circuito_detail.html
| |-- circuito_form.html
| `-- circuito_list.html
|-- equipos
| |-- equipo_confirm_delete.html
| |-- equipo_detail.html
| |-- equipo_form.html
| `-- equipo_list.html
|-- noticias
| |-- noticia_confirm_delete.html
| |-- noticia_form.html
| `-- noticia_list.html
`-- pilotos
|-- piloto_confirm_delete.html
|-- piloto_detail.html
|-- piloto_form.html
`-- piloto_list.html
当我运行服务器,为应用程序“消息报”的服务器说的错误:
TemplateDoesNotExist at /noticias/
noticias/noticia_list.html
Request Method: GET
Request URL: http://178.62.112.135/noticias/
Django Version: 1.6.1
Exception Type: TemplateDoesNotExist
Exception Value:
noticias/noticia_list.html
Exception Location: /usr/lib/python2.7/dist-packages/django/template/loader.py in select_template, line 186
Python Executable: /usr/bin/python
Python Version: 2.7.6
Python Path:
['/home/django/django_project',
'/home/django',
'/usr/bin',
'/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu',
'/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old',
'/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages']
Server time: Wed, 16 Nov 2016 08:43:22 +0000
我加入manage.py文件下面的代码:
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',
],
},
},
]
但它不工作。我如何解决它?
你的模板是在模板文件夹,而不是新闻短片文件夹?你如何调用模板的文件夹? – junkfoodjunkie
@ Mr.A我删除了它,但它说的是相同的 – Albert
我一直在尝试很多事情,但没有任何工作。我的项目是在Django 1.10和Digital Ocean有Django 1.6。我更新了Digital Ocean的django版本,但即使这样也行不通。请有人能帮助我吗? – Albert