title: Page not found (404) when submitting a form in Django
body: <p>I am working through the Tango With Django tutorial.  I am trying to allow the user to register with the app.  However, when the user presses the submit button, I get this error message:</p>
  
  <pre><code>Page not found (404)
  Request Method: POST
  Request URL:    http://127.0.0.1:8000/rango/register/rango/register/
  Using the URLconf defined in tango_with_django_project.urls, Django tried these URL patterns, in this order:
  ^admin/
  ^rango/ ^$ [name='index']
  ^rango/ ^about$ [name='about']
  ^rango/ ^add_category/$ [name='add_category']
  ^rango/ ^category/(?P&lt;category_name_url&gt;\w+)/$ [name='category']
  ^rango/ ^category/(?P&lt;category_name_url&gt;\w+)/add_page/$ [name='add_page']
  ^rango/ ^register/$ [name='register']
  media/(?P&lt;path&gt;.*)
  The current URL, rango/register/rango/register/, didn't match any of these.
  </code></pre>
  
  <p>I'm not sure how that weird path is being built.  Here is registration template:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;Rango&lt;/title&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      &lt;h1&gt;Register with Rango&lt;/h1&gt;
  
      {% if registered %}
      Rango says: &lt;strong&gt;thank you for registering!&lt;/strong&gt;
      &lt;a href="/rango/"&gt;Return to the homepage.&lt;/a&gt;&lt;br /&gt;
      {% else %}
      Rango says: &lt;strong&gt;register here!&lt;/strong&gt;&lt;br /&gt;
  
      &lt;form id="user_form" method="post" action="rango/register/"
        enctype="multipart/form-data"&gt;
  
        {% csrf_token %}
  
        {{ user_form.as_p }}
        {{ profile_form.as_p }}
  
        &lt;input type="submit" name="submit" value="Register" /&gt;
  
      &lt;/form&gt;
      {% endif %}
  
    &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>In order to get to the registration template, you need to click this link in the index template:</p>
  
  <pre><code>&lt;a href="/rango/register"&gt;Register Here&lt;/a&gt;
  </code></pre>
  
  <p>Here is the register function in rango/views.py:</p>
  
  <pre><code>def register(request):
    registered = False
  
    if request.method == 'POST':
      user_form = UserForm(data=request.POST)
      profile_form = UserProfileForm(data=request.POST)
  
      if user_form.is_valid() and profile_form.is_valid():
        user = user_form.save()
  
        user.set_password(user.password)
        user.save()
  
        profile = profile_form.save(commit=False)
        profile.user = user
  
        if 'picture' in request.FILES:
          profile.picture = request.FILES['picture']
  
        profile.save()
  
        registered = True
  
      else:
        print user_form.errors, profile_form.errors
  
    else:
      user_form = UserForm()
      profile_form = UserProfileForm()
  
    return render(request,
      'rango/register.html',
      {'user_form': user_form, 'profile_form': profile_form, 'registered': registered})
  </code></pre>
  
  <p>I am sure I am missing something small!</p>