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

  • Home
  • SEARCH
  • 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 8906049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:33:05+00:00 2026-06-15T02:33:05+00:00

I get a Name error while trying to run my project, urls.py import os

  • 0

I get a Name error while trying to run my project,

urls.py

import os
from django.conf.urls.defaults import patterns, include, url
#from bookmarks.views import *
from django.views.generic.simple import direct_to_template
from preview.views import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()

urlpatterns = patterns('',

    (r'^catalog/$', home),
)

views.py

# Create your views here.
from django.shortcuts import render_to_response

def home(request):
    return render_to_response("index.html")

index.html

{% extends base.html %}
{% block content %}
    <h2>Welcome!</h2>
{% endblock %}

settings.py

TEMPLATE_DIRS = (
    "C:/python27/Djangoprojects/ecomstore/preview",
    # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates".
    # Always use forward slashes, even on Windows.
    # Don't forget to use absolute paths, not relative paths.
)

Error

NameError at /catalog/
name 'home' is not defined
Request Method: GET
Request URL:    http://127.0.0.1:8000/catalog/
Django Version: 1.3.1
Exception Type: NameError
Exception Value:    
name 'home' is not defined
Exception Location: C:\Python27\Djangoprojects\ecomstore\..\ecomstore\urls.py in <module>, line 12
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.2
  • 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-06-15T02:33:06+00:00Added an answer on June 15, 2026 at 2:33 am

    Is home in your preview/views.py file? Somehow your from preview.views import * did not import it in.

    In which case, can you try to do

    urlpatterns = patterns('preview.views',
    
        (r'^catalog/$', 'home'),
    )
    

    instead?

    And double check that the preview app is included in your INSTALLED_APPS tuple in your settings.py file.

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

Sidebar

Related Questions

I' getting the following error while trying to run my application from oauth2client.appengine import
Django's get_or_create function always cause get() returned more than one Model name error in
i get this error when trying this: ERROR method name expected. How should i
I'm getting this error while trying to run my application... The redirect URI in
I am trying to get a crontab task to work on a django project
I'm trying to do ALTER table tbl_name Engine=MyISAM; and I get ERROR 1217 (23000):
If I do this stuff.addEventListener(FooEvent.NAME, function(e:FooEvent) { dispatchEvent(e); } I get a runtime error
I'm trying to get familiar with CI and I have run into a problem
i'm trying to get a query that returns rows only with a specified name,
I am trying to consume a .net web service, and get the following error

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.