我正在尝试在一个应用中添加用户,然后调用网络应用来显示用户个人资料。
但我无法访问我的网络应用。我在这做错了什么。
def post(self, request, *args, **kwargs):
form = LoginForm(request.POST)
if form.is_valid():
if request.POST['username'] and request.POST['password']:
username = request.POST['username']
password = request.POST['password']
user = authenticate(username=username, password=password)
if user is not None:
if user.is_active:
login(request, user)
return HttpResponse(reverse("network"))
else:
return HttpResponse("alpha")
else:
return LoginForm()
我的网址文件是
urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^login', views.LoginView.as_view(), name='login'),
url(r'^register', views.RegistrationView.as_view(), name='registration'),
url(r'network', include('network.urls', namespace="network", app_name='network')),
我如何访问我的网络网址,因为这不起作用