0

作成中の Django アプリにログインしようとするたびに、ブラウザーに次のエラーが表示されます。

Request Method: POST
Request URL:    http://127.0.0.1:8000/login/
Django Version: 1.6 #UPDATE: HAVE DOWNGRADED TO DJANGO 1.5 AND STILL GETTING THIS ERROR
Exception Type: AttributeError
Exception Value:    
'bool' object has no attribute 'rindex'
Exception Location: /Library/Python/2.7/site-packages/django/core/urlresolvers.py in get_mod_func, line 141
Python Executable:  /usr/bin/python
Python Version: 2.7.2
Python Path:    
['/Users/gersande/Public/CompWebsite/uc',
 '/Library/Python/2.7/site-packages/web.py-0.37-py2.7.egg',
 '/Library/Python/2.7/site-packages/PyMySQL-0.5-py2.7.egg',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC',
 '/Library/Python/2.7/site-packages']
Server time:    Fri, 9 Aug 2013 00:09:03 -0500

これは私views.pyのもので、ごく最近まで機能していましたが、現在、このエラーが発生しています。一体何が起こっているのか、誰にも考えがありますか?

@csrf_protect
@cache_page(60 * 15)
def login_user(request):
    #inactive_image_url = ""
    #invalid_credentials_url = ""
    context_instance=RequestContext(request)
    if request.POST:
        username = request.POST.get('username')
        password = request.POST.get('password')
        user = authenticate(username=username, password=password)
        if user is not None:
            if user.is_active:
                login(request, user)            
                state = "You're successfully logged in!"
                return render_to_response('uc/portal/index.html', {'state':state, 'username':username}, context_instance=RequestContext(request))
            else:
                state_img = inactive_image_url
                state = "Your account is not active, please contact UC admin."
        else:
            state_img = invalid_credentials_url
            state = "Your username and/or password were incorrect."
    return render_to_response('uc/index.html', 
            {'state': state,
             'state_img': state_img,
             'username': username
            }, context_instance=RequestContext(request))
def portal(request):
    username = 'username'
    return render_to_response('uc/portal/index.html', 
            {'username': username,
            })

編集

これは私のurls.pyです:

from django.conf.urls import patterns, include, url 
from django.conf import settings 
from django.conf.urls.static import static 
from django.conf.urls import * 

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 

urlpatterns = patterns('', 
url(r'^/$','portal.views.index'), 
url(r'^uc/$', 'portal.views.index'), 
url(r'^$','portal.views.index'), 
url(r'^index/$', 'portal.views.index'), 
# Login / logout. 
url(r'^registration/$', 'portal.views.registration'), 
url(r'^login/$', 'portal.views.login_user'), 
url(r'^portal/$', 'portal.views.portal'), 
# Static part of the website 
url(r'^team/$', 'portal.views.team'), 
url(r'^about/$', 'portal.views.about'), 

私の構成ファイル (settings.py) は、 http://dpaste.com/1336541/で見ることができます。

再度編集 Django 1.5 にダウングレードしましたが、まだこのエラーが発生しています。何が起こっているのか、なぜログインが機能しないのかわかりません。私のグーグルが私のケースに役立つものを何も思いつかず、本当にイライラしているので、誰かがこれを理解するのを手伝ってくれることを本当に望んでいます.

4

1 に答える 1