Django tried loading these templates, in this order:
django.template.loaders.filesystem.Loader:
/home/voger/PycharmProjects/microblog/microblog/templates/index.htmlοΏ½(File does not
exist)django.template.loaders.app_directories.Loader:
/home/voger/blog-venv/lib/python2.7/site-packages/django/contrib/auth/templates/index.htmlοΏ½(File does not
exist)/home/voger/blog-venv/lib/python2.7/site-packages/django/contrib/admin/templates/index.htmlοΏ½(File does not
exist)django.template.loaders.eggs.Loader:If it would try the first two lines the file is sitting right
there so what is wrong with it?
Hi I am new to both Python and Django. I am studying various tutorials and now I am following the tutorial from http://gettingstartedwithdjango.com where the author walks through the creation of a simple microblog.
I tried to follow the tutorial to the point but I keep getting TemplateDoesNotExist at /. Then I tried to modify few things but still I keep getting the error. Right now the configuration is like this.
My project tree:
microblog/
├── manage.py
├── microblog
│ ├── __init__.py
│ ├── __init__.pyc
│ ├── settings
│ │ ├── base.py
│ │ ├── base.pyc
│ │ ├── __init__.py
│ │ ├── __init__.pyc
│ │ ├── local.py
│ │ └── local.pyc
│ ├── urls.py
│ ├── urls.pyc
│ ├── views.py
│ ├── wsgi.py
│ └── wsgi.pyc
├── requirements.txt
└── templates
├── 500.html
└── index.html
My settings/base.py which is essentially equivalent to settings.py
import os
...
PROJECT_ROOT = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
...
TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
'django.template.loaders.eggs.Loader',
)
...
TEMPLATE_DIRS = (
os.path.join(PROJECT_ROOT, 'templates'),
)
My urls.pyurlpatterns = patterns('',
from django.views.generic import TemplateView
...
...
url(r'^$', TemplateView.as_view(template_name="index.html")),
...
)
and I added a views.py just in case
from django.views.generic import TemplateView
class HomepageView(TemplateView):
template_name = "index.html"
Always I get the error message "TemplateDoesNotExist at /"
Django tried loading these templates, in this order:
- Using loader
django.template.loaders.filesystem.Loader:
/home/voger/PycharmProjects/microblog/microblog/templates/index.html(File does not exist)- Using loader
django.template.loaders.app_directories.Loader:
/home/voger/blog-venv/lib/python2.7/site-packages/django/contrib/auth/templates/index.html(File does not exist)/home/voger/blog-venv/lib/python2.7/site-packages/django/contrib/admin/templates/index.html(File does not exist)- Using loader
django.template.loaders.eggs.Loader:
If it would try the first two lines the file is sitting right there so what is wrong with it?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.