У меня есть некоторые проблемы с тем, чтобы мои шаблоны работали. В целом очень не уверены, как настроить статические файлы и шаблоны в моем каталоге проектов.Настройка шаблона и статических файлов с Django 1.8
Должен ли я как лучше всего размещать свои шаблоны внутри папки приложения при разработке и мои статические файлы внутри папки приложения?
Это выход:
Django tried loading these templates, in this order:
Using loader django.template.loaders.filesystem.Loader:
Using loader django.template.loaders.app_directories.Loader:
/Users/username/Dev/test_dev_01/projects/test/main/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/tinymce/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mce_filebrowser/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/django/contrib/auth/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/django/contrib/sitemaps/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/conf/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/core/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/generic/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/pages/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/blog/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/forms/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/galleries/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/mezzanine/accounts/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/avatar/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/filebrowser_safe/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/grappelli_safe/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/django/contrib/admin/templates/main/templates/index.html (File does not exist)
/Users/username/Dev/test_dev_01/lib/python3.4/site-packages/django_comments/templates/main/templates/index.html (File does not exist)
urls.py:
url(r"^$", "main.views.home", name="home"),
views.py:
def home(request):
return render(request, "main/templates/index.html", context)
settings.py:
PROJECT_APP_PATH = os.path.dirname(os.path.abspath(__file__))
PROJECT_APP = os.path.basename(PROJECT_APP_PATH)
PROJECT_ROOT = BASE_DIR = os.path.dirname(PROJECT_APP_PATH)
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
#os.path.join(PROJECT_ROOT, 'templates')
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
# Insert your TEMPLATE_CONTEXT_PROCESSORS here or use this
# list if you haven't customized them:
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.static",
"django.core.context_processors.media",
"django.core.context_processors.request",
"django.core.context_processors.tz",
"mezzanine.conf.context_processors.settings",
"mezzanine.pages.context_processors.page",
"main.context_processors.global_settings",
],
},
},
]
Что может быть причиной этого? Я не могу понять.
Где находятся файлы шаблонов на самом деле? –