Error title: 'str' object has no attribute 'regex'
Error description:
Attributeerror at/user/register/
'Str' object has no attribute 'regex' Request Method: Post
Request URL: http: // 127.0.0.1: 8000/user/register/
Django version: 1.3.1
Exception type: attributeerror
Exception value: 'str' object has no attribute 'regex'
Exception location: C: \ python25 \ Lib \ Site-packages \ Django \ core \ urlresolvers. py in _ populate, line 198
Python executable: C: \ python25 \ python.exe
Python version: 2.5.4
Python path: ['f: \ demo \ Python \ ucenter ',
'C: \ python25 \ Lib \ Site-packages \ setuptools-0.6c8-py2.5.egg ',
'C: \ Program Files (x86) \ jetbrains \ pycharm 1.5.3 \ helpers ',
'F: \ demo \ Python \ ucenter \ ucenter ',
'F: \ demo \ Python \ ucenter ',
'C: \ Windows \ system32 \ python25.zip ',
'C: \ python25 \ dlls ',
'C: \ python25 \ Lib ',
'C: \ python25 \ Lib \ Plat-win ',
'C: \ python25 \ Lib-TK ',
'C: \ python25 ',
'C: \ python25 \ Lib \ Site-packages ',
'C: \\ python25 \ Lib \ Site-packages \ Pil ',
'C: \\ python25 \ Lib \ Site-packages \ Win32 ',
'C: \\ python25 \ Lib \ Site-packages \ Win32 \ Lib ',
'C: \\ python25 \ Lib \ Site-packages \ pythonwin']
Server time: Thu, 3 Nov 2011 10:07:47 + 0800
Error analysis:
Return page in vews. py: Return httpresponseredirect (reverse ('user _ Index '))
The configuration in URLs. py is as follows:
From Django. conf. URLs. defaults Import Patterns, URL
Import OS
Import Settings
# From Django. Views. Generic import listview, detailview
# From users. Models import userinfo
# Uncomment the next two lines to enable the admin:
# From Django. contrib import Admin
# Admin. autodiscover ()
Urlpatterns = patterns ( '' ,
URL (R ' ^ User/register/$ ' , ' Ucenter. Users. Views. Register ' , Name =' User_register ' ),
# URL (R' ^ index/$ ', 'ucenter. Users. Views. Index', name = 'user _ Index '),
URL (R ' ^ Index/$ ' , ' Ucenter. Users. Views. Index ' , Name = ' User_index ' ),
# Examples:
)
Error because user_index cannot be mapped to the URL http: // 127.0.0.1: 8000/index/
That is, there is a problem with URL ing.
Solution:
Solution 1: directly modify return httpresponseredirect ('/index /')