今天写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了