Reputation: 61
I am not able to map html files from the directory, however i've followed all the instructions.
Following is my project urls.py:-
from django.conf.urls import patterns, include, url
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
url(r'^articles/', include('article.urls')),
)
Views.py in app:-
from django.shortcuts import render_to_response
from article.models import Article
def articles(request):
return render_to_response('articles.html',{'articles':
Article.objects.all()})
def article(request, article_id=1):
return render_to_response('article.html',{'article':
Article.objects.get(id=article_id)})
Urls.py in app:
from django.conf.urls import patterns, include, url
urlpatterns = patterns('',
url(r'^all/$', 'artilce.views.articles'),
url(r'^get/(?P<article_id>\d+)/$', 'article.view.article'),
)
Settings.py shows exact location of template folder as:-
TEMPLATE_DIRS = (
'C:\Python27\Scripts\django_test\article\templates',
Kindly advise. It shows article on 404 page but couldn't map.
Upvotes: 0
Views: 507
Reputation: 1558
You need to use unix-style forward slashes for your path, even on Windows. See the doc page here: https://docs.djangoproject.com/en/1.6/ref/settings/#template-dirs
Upvotes: 1