page not redirecting after login in django

def signup(request):
    if request.user.is_authenticated:
        return redirect('home')
    if request.method=="POST":
        form= UserCreationForm(request.POST)
        if form.is_valid():
            form.save()
            username= form.cleaned_data.get('username')
            password= form.cleaned_data.get('password1')
            user=authenticate(username=username,password=password)
            login(request,user)
            return redirect('home')
        else:
            form=UserCreationForm()
            return render(request,'polls/register.html',{'form':form})     
    else:
        form=UserCreationForm()
        return render(request,'polls/register.html',{'form':form})

register.html file:

<div class="container">
            <div class="row align-items-center vh-100">
                <div class="col-3 mx-auto">
                    <div class="card border-info mb-3" style="max-width: 40rem;"id='card'>
                        <div class="card-header text-center">Create a Secure Account<br> Welcome to Polls App</div>
                            <div class="form">
                                <form class="p-4"action="{% url 'signup' %}" method="post">
                                    {% csrf_token %}
                                    <div class="card-body ">
                                        <p class="card-text">{{form}}</p>
                                    </div>
                                    <div class=" d-flex justify-content-center">
                                        <button type="submit" class="btn btn-info ">CREATE ACCOUNT</a></button>
                                    </div>    
                                </form>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

please check the urls and name in path you must see name=home etc

Side note: When posting code or templates here, post the code between lines of three backtick - ` characters. This means you’ll have a line of ```, then your code, then another line of ```. (I’ve taken the liberty of editing your original post for you.)

I suggest you remove the form=UserCreationForm() from your else block here. If there is an error in the validation process of the form, you want to see those errors, and rerendering the form that was validated is the way to do that.

Aside from that, what requests are you seeing in your log during this process? Are you getting any error messages there?

You’re saying that the page is not redirecting - what is happening?

thanks, my code is working now

thanks my code is working now