English 中文(简体)
名称错误: 名 BBLingView 未定义NameError: 名称未定义
原标题:NameError: name BillingView is not defined
  • 时间:2012-05-28 14:11:24
  •  标签:
  • django

这是我的URL:

from views import *

urlpatterns = patterns(  ,

    url(r ^$ , BillingView.as_view(), name="index"),

)

这是我 views. py 中的方法:

class BillingView(BaseCompositeView):

    """
    A view that lets you record new billing information. This view includes all
    of the forms needed by the users on one page.
    """
    # We cannot easily override FormView since this view uses multiple forms

    template_name = "billing/base_billing.html"

为什么我的观点是无法理解的?

最佳回答

你用的是对讲1.4?

您可能想要这个用于导入 :

from project.billing.views import *

NameError 是指您重新引用了当前范围内尚未定义或宣布的东西。

编辑 :

为了帮助诊断问题,请尝试一下:

python manage.py shell
>>> import django
>>> django.get_version()
 1.2.3 
>>> import sys
>>> sys.path
[ /list/of/paths ,  /and/other/paths/ ]

检查一下正确的图书馆是否在你的道路上。你可能会发现,你的网站- libs 文件夹里有更新版的对接。

当您从开发服务器或生产网络服务器运行时, 何时会收到 NameError? 请显示全部错误和堆放跟踪 。

问题回答

暂无回答




相关问题
How to get two random records with Django

How do I get two distinct random records using Django? I ve seen questions about how to get one but I need to get two random records and they must differ.

Moving (very old) Zope/Plone Site to Django

I am ask to move data from a (now offline) site driven by Plone to a new Django site. These are the version informations I have: Zope Version (unreleased version, python 2.1.3 ) Python Version 2.1....

Can Django models use MySQL functions?

Is there a way to force Django models to pass a field to a MySQL function every time the model data is read or loaded? To clarify what I mean in SQL, I want the Django model to produce something like ...

Flexible pagination in Django

I d like to implement pagination such that I can allow the user to choose the number of records per page such as 10, 25, 50 etc. How should I go about this? Is there an app I can add onto my project ...

is it convenient to urlencode all next parameters? - django

While writing code, it is pretty common to request a page with an appended "next" query string argument. For instance, in the following template code next points back to the page the user is on: &...

Pragmatically adding give-aways/freebies to an online store

Our business currently has an online store and recently we ve been offering free specials to our customers. Right now, we simply display the special and give the buyer a notice stating we will add the ...

热门标签