title: How to redirect properly in Django URL , I am having issue in redirecting
body: <ul>
  <li><p>Having issue with redirecting, I am at registration page("accounts/register") on my website where I want if someone register then a verification code will send on his email id and to verify we have a url "accounts/verify". but when I am trying to register it register a user but does not send them on "accounts/verify" instead it send that to "accounts/register/accounts/verify" ,</p></li>
  <li><p>Also please let me know how to use user email address, while registering him into database. I just want his email id to send verification code.</p></li>
  </ul>
  
  <blockquote>
    <p>Here is my URL.py of my app:</p>
  </blockquote>
  
  <pre><code>from django.contrib import admin
  from django.urls import path,include
  from . import views
  from django.contrib.auth.models import User
  
      urlpatterns = [
          path('login/', views.login, name='Login-Page'),
          path('register/', views.register, name='Registeration-page'),
          path('logout/', views.logout),
          path('verify/', views.verify, name='verification page')
  </code></pre>
  
  <blockquote>
    <p>Here is my View.py for registration and profile:</p>
  </blockquote>
  
  <pre><code>from django.shortcuts import render, redirect
  import requests
  from django.contrib.auth.models import User, auth
  from django.contrib import messages
  from datetime import date
  import smtplib
  import random
  from email.mime.multipart import MIMEMultipart
  from email.mime.text import MIMEText
  
  def register(request):
  
      if request.method == 'POST':
          first_name = request.POST['first_name']
          last_name = request.POST['last_name']
          username = request.POST['username']
          email = request.POST['email']
          password1 = request.POST['password1']
          password2 = request.POST['password2']
  
          if password1==password2:
              if User.objects.filter(username=username).exists():
                  messages.info(request, "Username already taken")
                  return redirect('accounts/register')
              elif User.objects.filter(email=email).exists():
                  messages.info(request, "email already taken")
                  return redirect('accounts/register')
              else:
                  user = User.objects.create_user(username=username, password=password1, email=email, first_name=first_name, last_name=last_name)
                  user.save();  
                  return redirect('accounts/verify') # 'accounts/login'
          else:
              messages.info(request,"password not matched")
              return redirect('accounts/register')
  
      else:
          return render(request, 'register.html')
  
  
  def verify(request):
      if request.method == 'POST':
          sender_address = 'xyz@gmail.com'
          sender_pass = 'password'
          user_email = register.user.objects.email
          receiver_address = user_email
          passd = random.randrange(111111,10000000,39)
          mail_content = "Hello This is your verficatiob code   " + str(passd)
  
          def check(code):
              if code==passd:
                  return redirect('accounts/login')
              else:
                  messages.info(request,"Code is incorrect")
                  return redirect('accounts/verify')
  
  
          message = MIMEMultipart()
          message['From'] = sender_address
          message['To'] = receiver_address
          message['Subject'] = 'Verification Code'
          message.attach(MIMEText(mail_content, 'plain'))
          session = smtplib.SMTP(EMAIL_HOST, EMAIL_PORT)
          session.starttls()
          session.login(sender_address, sender_pass)
          text = message.as_string()
          session.sendmail(sender_address, receiver_address, text)
          session.quit()
          print('Mail Sent')
          code = request.POST['code']
  
          check(code)
      else:
          return render(request, 'email_verify.html')
  </code></pre>
  
  <blockquote>
    <p>Here is my register template:</p>
  </blockquote>
  
  <pre><code>&lt;div class="limiter"&gt;
          &lt;div class="container-login100" style="background-image: url ('/images/bg-01.jpg');"&gt;
              &lt;div class="wrap-login100 p-l-55 p-r-55 p-t-65 p-b-54"&gt;
                  &lt;form action="{{register}}" method="post"&gt;
                      {% csrf_token %}
                  &lt;!--&lt;form class="login100-form validate-form"&gt;--&gt;
                      &lt;span class="login100-form-title p-b-49"&gt;
                          Registration
                      &lt;/span&gt;
                      &lt;div&gt;
                      {% for message in messages %}
                      &lt;input class="wrap-input validate-input m-b-23" data-validate="{{message}}"&gt;
                      {% endfor %}
                      &lt;/div&gt;
  
                      &lt;div class="wrap-input100 validate-input m-b-23" data-validate = "First name is reauired"&gt;
                          &lt;span class="label-input100"&gt;&lt;th&gt;first name&lt;/th&gt;&lt;/span&gt;
                          &lt;input class="input100" type="text" name="first_name" placeholder="Type your First name"&gt;
                          &lt;span class="focus-input100" data-symbol="&amp;#xf206;"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class="wrap-input100 validate-input m-b-23" data-validate = "Last name is reauired"&gt;
                          &lt;span class="label-input100"&gt;&lt;th&gt;last name&lt;/th&gt;&lt;/span&gt;
                          &lt;input class="input100" type="text" name="last_name" placeholder="Type your Last name"&gt;
                          &lt;span class="focus-input100" data-symbol="&amp;#xf206;"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class="wrap-input100 validate-input" data-validate="Username is required"&gt;
                          &lt;span class="label-input100"&gt;Username&lt;/span&gt;
                          &lt;input class="input100" type="username" name="username" placeholder="Type your username"&gt;
                          &lt;span class="focus-input100" data-symbol="&amp;#xf190;"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class="wrap-input100 validate-input" data-validate="email is required"&gt;
                          &lt;span class="label-input100"&gt;email&lt;/span&gt;
                          &lt;input class="input100" type="email" name="email" placeholder="Type your email"&gt;
                          &lt;span class="focus-input100" data-symbol="&amp;#xf190;"&gt;&lt;/span&gt;
                      &lt;/div&gt;
  
                      &lt;div class="wrap-input100 validate-input" data-validate="password is required"&gt;
                          &lt;span class="label-input100"&gt;Password&lt;/span&gt;
                          &lt;input class="input100" type="password" name="password1" placeholder="Type your password"&gt;
                          &lt;span class="focus-input100" data-symbol="&amp;#xf190;"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;div class="wrap-input100 validate-input" data-validate="confirm password is required"&gt;
                          &lt;span class="label-input100"&gt;Confirm Password&lt;/span&gt;
                          &lt;input class="input100" type="password" name="password2" placeholder="Type your password Again"&gt;
                          &lt;span class="focus-input100" data-symbol="&amp;#xf190;"&gt;&lt;/span&gt;
                      &lt;/div&gt;
                      &lt;br&gt;
                      &lt;div class="container-login100-form-btn"&gt;
                          &lt;div class="wrap-login100-form-btn"&gt;
                              &lt;div class="login100-form-bgbtn"&gt;&lt;/div&gt;
                              &lt;button class="login100-form-btn"&gt;
                                  Register
                              &lt;/button&gt;
                          &lt;/div&gt;
                      &lt;/div&gt;
                  &lt;/form&gt;
               &lt;/div&gt;
            &lt;/div&gt;
         &lt;/div&gt;
  </code></pre>
  
  <blockquote>
    <p>This is the error:</p>
  </blockquote>
  
  <pre><code>Page not found (404)
  Request Method: GET
  Request URL:    localhost/accounts/register/accounts/verify
  Using the URLconf defined in made.urls, Django tried these URL patterns, in this order:
  
  admin/
  [name='Homepage']
  accounts/ login/ [name='Login-Page']
  accounts/ register/ [name='Registeration-page']
  accounts/ logout/
  accounts/ verify/ [name='verification page']
  </code></pre>