Register page redirect to home page or My page is not loading

The below codes are the codes i used to create my register form. When i try to go to, this was redirecting to my home page i mean it render my index.html page i cant find find any mistakes in my code. And, i dont know why this is redirecting to my home page. Even i try to new virtual env, copy my files to my friend laptop, reinstalled my browser but nothing works. Its been a weak still i can’t find what is happening here.

path('register/', views.register, name ='register')

def register(request):
    if request.method == 'POST':
        form = UserRegisterForm(request.POST)
        if form.is_valid():
            username = form.cleaned_data.get('username')
            email = form.cleaned_data.get('email')
            htmly = get_template('registration/email.html')
            d = { 'username': username }
            subject, from_email, to = 'Welcome', '', email
            html_content = htmly.render(d)
            msg = EmailMultiAlternatives(subject, html_content, from_email, [to])
            msg.attach_alternative(html_content, "text/html")
            messages.success(request, f'Your account has been created ! You are now able to log in')
            return redirect('login')
        form = UserRegisterForm(request.POST)
    return render(request, 'registration/register.html', {'form':form})

class UserRegisterForm(UserCreationForm):

    email = forms.EmailField()

    class Meta:
        model = User
        fields = {'username', 'email', 'password1', 'password2'}

    def save(self, commit=True):
        user = super(UserRegisterForm, self).save(commit=False) = self.cleaned_data['name'] = self.cleaned_data['email']
        if commit:
        return user


{% extends "index.html" %}
{% load crispy_forms_tags %}
{% block start %}

<div class="container">
    <form method="post" enctype="multipart/form-data">
        {% csrf_token %}
        {{ form }}
        <button type="submit">Submit</button>
    <sub><a href="{% url 'login' %}">Login to your Account</a></sub>

{% endblock start %}

This was the response I get when I try to go to the page.

[29/Jul/2021 07:43:33] "GET /register/ HTTP/1.1" 200 1317

Hi @GoAmeer030,

I can’t quite tell what you’re expecting to happen and what is happening. Can you elaborate on those for me please?

@CodenameTim I edited it bro. check it and help me with it bro.

We need some more clarification here.

Are you saying that, if you look at the page actually rendered in your browser (using either your browser’s developer tools or “view source”), you don’t see any of the parts of that HTML I quoted above? That you don’t see at least the <div class="container"> tag?

If not, we’ll need to see your index.html template.

(Also, I’ll point out that you have the lines of code:

That else clause is for the case when the request.method is not “POST”. Since the request is not a POST, request.POST is going to be null. There’s no value (and is potentially confusing) to be passing request.POST in to the constructor of your form.

This is the page loaded from“This Url”)

Sorry guys i cant upload page screenshot because i am a new user. As you guys can see that url is loading my index.html page. I made register.html and i assigned it to but instead of register.html, index.html is loading (register.html is on the question section). I guess @KenWhitesell and @CodenameTim you guys will understand it (Please see the url bar then you guys will understand my problem).

@KenWhitesell The code is my index.html

<!DOCTYPE html>
<html lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    {% load static %}
        @import url('');
    <link rel="stylesheet" href="{% static 'style.css' %}">
    <nav class="navbar">
                <li><a href="#">Danker Man</a></li>
            {% if user.is_authenticated %}
                <li><a href="#">Features</a></li>
                <li><a href="#">Disclaimer</a></li>
                <li><a href="#">PrivacyPolicy</a></li>
                <li><a href="#">Terms&Conditions</a></li>
                <li><a href="{% url 'bot' %}">Bot</a></li>
                <li><a href="{% url 'edit_profile' %}">Edit Profile</a></li>
            {% else %}
                <li><a href="#">Features</a></li>
                <li><a href="#">Disclaimer</a></li>
                <li><a href="#">PrivacyPolicy</a></li>
                <li><a href="#">Terms&Conditions</a></li>
                <li><a href="{% url 'login' %}">Login</a></li>
            {% endif %}
    {% block content %}
    <section class="content-container">
        <div class="content-box">
            <div class="content">
                <h1>Danker Man</h1>
                <p>This is a Discord Bot!</p>
    {% endblock content %}
    <section class="footer">
        <div id="cr">Copyrighted &copy by Danker Man</div>
    <script src="{% static 'app.js' %}"></script>

(“If you guys still cant understand me . Please send me a reply and i will make screen recording and attach that link in my next reply”)

For your register.html, you posted:

But I don’t see a {% block start %} {% endblock start %} pair in your index.html. The template you extend must provide a spot for the extension’s content to be placed.

@KenWhitesell Yes bro i made a silly mistake. Here after I more focused on my codes. Thanks a lot and keep your great job on.