林。我希望登录重定向到另一页并传递变量。 香港专业教育学院做了我的意见,但我把所有的时间误差404我读到“登录重定向的URL”,并默认为帐户/个人资料。我在我的模板里创建了一个文件夹。这是正确的方法吗?我把它储存在Django/MYAPP/MYAPP /模板/帐号/资料/ home.html的登录后重定向到使用Django 1.10嵌入式认证另一页
错误: “当前的URL,应收/型材/ home.html的,没有找到相关的这些。”
views.py
def home(request):
username = None
if request.user.is_authenticated:
username = request.user.username
return redirect('accounts/profile/home.html',{'username': username})
else:
return redirect('/accounts/profile')
myapp/ulrs.py
url(r'^accounts/profile/$', views.home, name='home')
我改变settings.py
LOGIN_REDIRECT_URL = '/'
任何建议将welcome.If IM这样做不对,请给我一个例子。
谢谢。
嗨感谢您的帮助 我试过了,但仍然有错误404。我应该在哪里保存tamplate home ?. 感谢 – OverHeat