Hey All,

So I have a django project in a directory for production.  I have the same 
exact project in a separate repository for development.  I literally have 
copied and pasted my project over and the only changes I have made are 
switching debug from false to true.  So my project has the same database, 
same code, everything.  When I start up my local copy and go to login, the 
login function does not work.  Below is my simple login view.  My code 
returns the print statement 'User is active' when I sign in with a user on 
my project page; however, my user never gets logged in during the next 
step.  Does anyone have any clues as to why this might be?  Thanks for your 
time.


views.py
def friend_login(request):
    if request.method == 'POST':
        username = request.POST.get('username')
        password = request.POST.get('password')
        user = authenticate(username=username, password=password)

        if user:
            if user.is_active:
                # the User model is valid and active, so we can log the 
user in
                print 'User is active'
                login(request, user)
                return HttpResponseRedirect(reverse('main:index'))
            else:
                # An inactive account was used - no logging in!
                print 'User is inactive'
                return render(request, 'friends/inactive.html', {'user':user
})
        else:
            # Bad login credentials
            return HttpResponse("Invalid login details supplied.")
    else:
        # Not a POST, so simply display the login form
        return render(request, 'friends/login.html', {})


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/8821e5bc-0a14-47e2-82bd-8b229daaf50d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to