ViewDoesNotExist at /index/

今天写django的时候出现一个问题如下:

ViewDoesNotExist at /index/

Could not import home.views.index. View does not exist in module home.views.
Request Method:GET
Request URL:http://127.0.0.1:8000/index/
Django Version:1.4
Exception Type:ViewDoesNotExist
Exception Value:
Could not import home.views.index. View does not exist in module home.views.
Exception Location:C:\Python27\lib\site-packages\django\core\urlresolvers.py in get_callable, line 101
Python Executable:C:\Python27\python.exe
Python Version:2.7.3
Python Path:
['C:\\Users\\lenovo\\Desktop\\stadyCode\\djangoStady\\mysite',
 'C:\\Python27\\lib\\site-packages\\pip-1.3.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\sqlalchemy-0.8.0dev-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\zope.interface-4.0.1-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\chardet-2.2.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\cocos2d-0.6.0-py2.7.egg',
 'C:\\Users\\lenovo\\Desktop\\cdmsCode\\cdms',
 'C:\\Users\\lenovo\\Desktop\\usbproxyCode\\usbproxy',
 'C:\\Users\\lenovo\\Desktop\\usbgatewayCode\\usbgateway',
 'C:\\Users\\lenovo\\Desktop\\rcmCode\\rcm\\src\\src',
 'C:\\Users\\lenovo\\Desktop\\stadyCode\\djangoStady\\mysite',
 'C:\\Python27',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Users\\lenovo\\AppData\\Roaming\\Python\\Python27\\site-packages',
 'C:\\Python27\\lib\\site-packages',
 'C:\\Python27\\lib\\site-packages\\PIL',
 'c:\\python27\\lib\\site-packages']
Server time:星期二, 10 六月 2014 13:32:29 +0800


抛出的异常是我的视图函数不存在但是我的views.py 一直存在index视图函数,


这是之前的urls:

#!/usr/bin/python
#coding:utf-8
__author__ = 'lenovo'

from django.conf.urls import patterns, include, url

urlpatterns = patterns('',
    url(r'^index/$',"home.views.index",name='index'),
   # url(r'^regist/$','home.views.register',name='register'),
    )


之后我改过之后再次运行又抛出的异常:

#!/usr/bin/python
#coding:utf-8
__author__ = 'lenovo'

from django.conf.urls import patterns, include, url
from  home import views

urlpatterns = patterns('',
    url(r'^index/$',views.index,name='index'),
   # url(r'^regist/$','home.views.register',name='register'),
    )


AttributeError at /index/

'module' object has no attribute 'CharFioeld'
Request Method:GET
Request URL:http://127.0.0.1:8000/index/
Django Version:1.4
Exception Type:AttributeError
Exception Value:
'module' object has no attribute 'CharFioeld'
Exception Location:C:\Users\lenovo\Desktop\stadyCode\djangoStady\mysite\home\form.py in Refixform, line 33
Python Executable:C:\Python27\python.exe
Python Version:2.7.3
Python Path:
['C:\\Users\\lenovo\\Desktop\\stadyCode\\djangoStady\\mysite',
 'C:\\Python27\\lib\\site-packages\\pip-1.3.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\sqlalchemy-0.8.0dev-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\zope.interface-4.0.1-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\chardet-2.2.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\cocos2d-0.6.0-py2.7.egg',
 'C:\\Users\\lenovo\\Desktop\\cdmsCode\\cdms',
 'C:\\Users\\lenovo\\Desktop\\usbproxyCode\\usbproxy',
 'C:\\Users\\lenovo\\Desktop\\usbgatewayCode\\usbgateway',
 'C:\\Users\\lenovo\\Desktop\\rcmCode\\rcm\\src\\src',
 'C:\\Users\\lenovo\\Desktop\\stadyCode\\djangoStady\\mysite',
 'C:\\Python27',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Users\\lenovo\\AppData\\Roaming\\Python\\Python27\\site-packages',
 'C:\\Python27\\lib\\site-packages',
 'C:\\Python27\\lib\\site-packages\\PIL',
 'c:\\python27\\lib\\site-packages']

突然发现这才是真正出现错误的原因,然后我将代码改过来,就ok了







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值