Search code examples
pythondjangodjango-templatespugpyjade

How to combine Django with Jade


I'm trying to combine Django with Jade, but I've had some problems. I have model which is named About. This has a view like this:

def about(request):
    return render_to_response('about.jade',{},RequestContext(request))

and in my urls I have:

url(r'about/', views.about),

But it provides an error that the Templates doesn't exist (and yes, it exists). Is it correct to write the url like this?

Any help would be appreciated!


Solution

  • If your getting the big Template does not exist page in your browser, this usually means that django cannot find where you have stored the your template file (irrespective of using jade).

    If you ve created a djnago 1.6 project you need to add the following line to settings:

    TEMPLATE_DIRS = [os.path.join(BASE_DIR, 'templates')]
    

    Then create a templates directory inside your app (not project) directory, and put your template there.