注册页面立即缓冲

时间:2018-05-24 00:51:42

标签: django

当我尝试在我的网站注册时,它会立即缓冲,

enter image description here

服务器正常运行,其他服务器编码得很好。

urls.py

urlpatterns = [
    #Login Page
    url(r"^login/$", login, {'template_name':'users/login.html'},
        name='login'),
    #Logout Page
    url(r"^logout/$", views.logout_view, name="logout"),
    # Registration Page
    url(r"^register/$", views.register, name='register'),
]

views.py

def register(request):
    """Register a new user."""
    if request.method != "POST":
        #display blank register form.
        form = UserCreationForm()
    else:
        # process completed form.
        form = UserCreationForm(data=request.POST)

        if form.is_valid():
            new_user = form.save()
            # Log the user in and then redirect to home page
            authenticate_user = authenticate(username=new_user.username,
                password=request.POST['password1'])
            login(request, authenticate_user)
            return HttpResponseRedirect(reverse('learning_logs:index'))

    context = {'form': form}
    return render(request, 'users/register.html', context)

仔细检查我在右侧views.py

register.html是:

{% extends "learning_logs/base.html" %}

{% block content %}

    <form  action="{% url "users:register" %}" method="post">
        {% csrf_token %}
        {{ form.as_p }}

        <button name="submit">log in</button>
        <input type="hidden" name="next" value="{% url "learning_logs:index" %}">

    </form>

{% endblock content %}

问题可能在哪里?

0 个答案:

没有答案