Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6862805
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:42:21+00:00 2026-05-27T02:42:21+00:00

This is my views.py: from django.http import HttpResponse from django.template.loader import get_template from django.template

  • 0

This is my views.py:

from django.http import HttpResponse
from django.template.loader import get_template
from django.template import Context
def login(request):
    t = get_template('login.html')
    return HttpResponse(t.render) 

In my urls.py I put

(r'^login/', include('project.views.login')),

to show my templates

I set my templates directory in settings.py

But i got an error named

ImportError at /login/
No module named login

What’s wrong ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T02:42:22+00:00Added an answer on May 27, 2026 at 2:42 am

    include is used to include other url configs from other apps. It shouldn’t be used if you’re trying to add a url pattern for one particular view. You should have something like

    (r'^login/', 'project.views.login'),
    

    The other problem is where you return your response. render is a method that takes a context (see the docs)

    def login(request):
        t = get_template('login.html')
        c = Context({})
        return HttpResponse(t.render(c)) 
    

    In practice, you wouldn’t usually load the template, render it, then return a response. There are two shortcut functions, render and render_to_response, that cut down on repetition.

    You’ve made a few basic mistakes here. I recommend you work through the Django tutorials (again, if you’ve already looked at them). Tutorial 3 in particular explains all this stuff.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this my middleware code : from django.conf import settings from django.template import RequestContext class
I am writing a GUI application using Django 1.1.1. This is the views.py: from
I'm trying to make a custom view in Django admin. I'm reading from this
say I have this $result = mysql_query('SELECT views FROM post ORDER BY views ASC');
Is it possible to re-write (Apache Mod-Rewrite) a URL from this: http://www.example.com/view.php?t=h5k6 to this
I'm trying to sync my db from a view, something like this: from django
I've just configured fandjango with my simply django application. Here's the files: VIEWS.PY from
This post extends the error while submitting data in the form django model.py from
When i access this url: http://localhost:8000/ProjectOverview/proj_view/15/ Django tells me that the format is in
The url im trying to match is: http://domain/games/getdata/genres/ This request is made via ajax

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.