CSRF verification failed when logging in

I am getting this error when signing in. I just implemented auth and I have done it before in other projects but haven’t had this issue. Not sure whats wrong. I reviewed docs and not sure what I am missing. I also am having trouble when signing up it doesn’t redirect me or save the user.

def signup(request):
    # POST request
    error_message = ''
        # user is signing up with a form submission
    if request.method == 'POST':
        form = UserCreationForm(request.POST)
        if form.is_valid():
            user = form.save()
            login(request, user)
            return redirect('index')
            error_message = 'invalid signup - try again'
    # GET request
        # user is navigating to signup page to fill out form
    form = UserCreationForm()
    return render(request, 'registration/signup.html', {
        'form': form,
        'error': error_message

Note: In the future, please do not post screen images. Copy/paste the template into the body of your post, surrounded by lines of three backtick characters, just like you do with code.

Also, please post the actual error message being received on the console.

Is this in a development environment using runserver? Or is this in a deployed environment? If the latter, please describe how you have your system deployed.
(If this is a development environment using runserver, do you have debug=True?)

Thank you for responding, here is the error I am getting:
Field ‘id’ expected a number but got <SimpleLazyObject: <django.contrib.auth.models.AnonymousUser object at 0x1118d1410>>.

I did deploy to Heroku but I am getting the error when running on local host in development. Debug is still true