在我的网络应用程序上,使用开发服务器http://127.0.0.1:8000/时,注册和登录非常有效,但是当我在Heroku上部署网站时,它无法正常工作..仅使用{{ 1}}的作品..
此外,注册后用户会在注册后自动登录。
但是当他们注销..他们无法再次登录
这是我的代码:
注册视图
down
forms.py
createsuperuser
urls.py
def signup(request):
current_user_ip = get_client_ip(request)
current_temp = Temp.objects.filter(created_by_ip=current_user_ip)
current_temp.delete()
if request.method == 'POST':
signup_form = SignUpForm(request.POST, request.FILES)
if signup_form.is_valid():
signup_form.save()
messages.info(request, "Thanks for registering. You are now logged in.")
new_user = authenticate(username=signup_form.cleaned_data['email'],
password=signup_form.cleaned_data['password1'],
)
login(request, new_user)
return redirect('dashboard')
else:
signup_form = SignUpForm()
context = {
'signup_form': signup_form,
}
return render(request, 'signup.html', context)