'Str' object has no attribute 'regex'

Source: Internet
Author: User

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 /')

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.