I'm experimenting with Django, and figuring out how to set urls.py, and how the URLs work.
I've configured urls.py in the root of the project, to directs to my blog and admin.
But now I want to add a page to my home, so at localhost:8000
.
So I've added to following code to the urls.py in the root of the project:
from django.views.generic.simple import direct_to_template
urlpatterns = patterns('',
(r"^$", direct_to_template, {"template": "base.html"}),
)
The problem is that it searches for the template in blog/templates/... Instead of the templates folder in my root. Which contains the base.html.
Full urls.py:
from django.conf.urls import patterns, include, url
from django.views.generic.simple import direct_to_template
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
(r"^$", direct_to_template, {"template": "base.html"}),
url(r'^blog/', include('hellodjango.blog.urls')),
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
(r'^tinymce/', include('tinymce.urls')),
)
Am I overlooking something?