I have a blog application and application has a urls.py which includes generic view
urlpatterns = patterns("",
url(r'^', ListView.as_view(
queryset=Post.objects.all().order_by("-created")[:2],
template_name='index.html')),
)
I send 2 data.
In main project urls.py like that:
urlpatterns = patterns("",
url(r"^$", direct_to_template, {"template": "index.html"}, name="home"),
url(r"^admin/", include(admin.site.urls)),
url(r"^blog/", include('blog.urls')),
)
I can see retrieved datas from db 127.0.0.1/blog/ I want to also see in 127.0.0.1 I mean in the start page.
I add this:
url(r"^$", include('blog.urls), direct_to_template, {"template": "index.html"}, name="home"),
But does not work. How can I achieve this?
This should Work, seems you have missed the closing of single quotes on your urls.py.I am using this and it works fine.