Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Long login times with Django Allauth
I set up my project using cookiecutter Django (https://cookiecutter-django.readthedocs.io/en/latest/index.html) with async and docker option turned on. Registering on the website works fast, only the sing in takes around 30 seconds. My Allauth configuration is set like this: # django-allauth ACCOUNT_ALLOW_REGISTRATION = env.bool("DJANGO_ACCOUNT_ALLOW_REGISTRATION", True) ACCOUNT_AUTHENTICATION_METHOD = "username" ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_EMAIL_VERIFICATION = "none" ACCOUNT_ADAPTER = "tum_vr.users.adapters.AccountAdapter" SOCIALACCOUNT_ADAPTER = "tum_vr.users.adapters.SocialAccountAdapter" Apart from that I used the base configuration from cookiecutter Django. Does anyone have an idea where I need to look for errors to fix this problem? -
Django problem on book Антонио Меле - "Django 2 в примерах"
I'm all trying to get over Django. I open the book by Antonio Mele - "Django 2 in Examples" and do everything as in the book. But for some reason I get errors. So this time I got stuck on the chapter Creating a Model Manager. The book says: Edit the models.py file of the blog application to add your me- nejer: class PublishedManager(models.Manager): def get_queryset(self): return super().get_queryset().filter(status='published') class Post(models.Model): # ... objects = models.Manager() # Менеджер по умолчанию. published = PublishedManager() # Наш новый менеджер. python manage.py runserver enter image description here And I create a post again to help me. I don't understand how you can do something in this Django? it gives errors all the time! it's harder than learning python -
Warning: Your slug size (386 MB) exceeds our soft limit (300 MB) which may affect boot time
What will be the expected delay in boot time? This is from heroku and I had deployed a Django site. -
Not allowed to load local resource: I got this error in chrome console
I am doing an Django application , while placing a Background picture i got this error in console Not allowed to load local resource: file:///C:/UsersThripura%20saiPycharmProjectspythonProjectecomuploadsproducts%E0%AB%8ER_Aspire_7.jpeg my html code <style> body{ margin:0; color:#6a6f8c; background:#c8c8c8; background-image: url('C:\Users\Thripura sai\PycharmProjects\pythonProjectecom\uploads\products\ACER_Aspire_7.jpeg'); background-attachment: fixed; background-size: 100% 100%; background-repeat: no-repeat; font:600 16px/18px 'Open Sans',sans-serif; } nav{ background-color: black; } .one-edge-shadow { box-shadow: 0 8px 2px -5px rgb(246, 245, 245); } .display-8{ font-weight: 200; font-size: 30px; } please help me to to resolve this error -
Django queryset get quantity for all products
I have a query running inside a view that returns two records: cart_items = cartItem.objects.filter(cart=cart, is_active=True) <QuerySet [<cartItem: cartItem object (304)>, <cartItem: cartItem object (305)>]> 1 1 I'm trying to set the quantity and the name based on the query, meaning quantity=2 and name=Test, Test2 However i get quantity only for 1 product, (below code is running inside the view). for cart_item in cart_items: quantity = cart_item.quantity print(quantity) name = cart_item.product.name How can i set quantity based on the query? What i'm doing wrong? Thank you -
How do I load static JavaScript files inside django framework
I know I'm doing something wrong, after consulting the docs and watching 3 YouTube videos that get it spun up in the first 7 min and copying them it still doesn't work I'm basically trying to get to hello world from clicking a button The Relevant lines in my HTML {% extends 'box2.html' %} {% load static %} {% block content %} <button class="btn btn-success mt-3" type="button" onclick="handle_do_thing_click()" type="">Add Planner</button> {% endblock %} {% block js_block %} <script type = "text/javascript/" src="{% static 'js/doThing.js' %}"></script> {% endblock %} my settings.py static settings INSTALLED_APPS = ['django.contrib.staticfiles'] STATIC_URL = '/static/' STATICFILES_DIRS = [BASE_DIR / 'static'] and my js file which exists in app/static/js/doThing.js is hello world function handle_do_thing_click() { console.log("hello world"); } -
Why do I get 403 forgidden when cookies are used, and success if POST request is without cookies?
I use Django as my server and Android app as client. OkHttp on client side. It uses CookieJar for cookie handling. CookieJar works because I have a page that is availble only if user is signed in (aka has cookie). I have http://../api/picture/create/ page. It accepts post requests. When I try to send post request from andorid app, I get Forbidden: /api/picture/create/ [15/May/2021 13:23:28] "POST /api/picture/create/ HTTP/1.1" 403 58 If I use the same json body in browser (new client or authorised client = with or without cookies), it works perfectly fine. As well as if I remove cookie jar from OkHtttp client fro android. So, to be clear. It works if: No cookies in POST request With cookies in POST request if I use chrome with UI that django provides (mean I logged in first and then send post request to create picture) I am sure that cookies are not recreated in android app. Ones I logged in, I have only 1 cookie for okHttp cliient. So I am not even sure if it is Django or CookieJar/OkHttpClient error. Any tips where should I look to understand what is wrong? CookieJar setup static CookieJar cookieJar = new CookieJar() { … -
How to display post created time according to users country like Twitter in Django?
I tried django-tz-detect but it's not working in production. I also tried django-easy-timezones module that's also not working for me. I just want to convert UTC timezone to users country's timezone like Twitter or other social media in Django. -
Loop in Field name
I am trying to define a class with its different fields please someone can help me loop on the index of the field so that it is clean ? class Tabletarif (models.Model): age_duree = models.CharField (max_length = 4) U_20 = models.FloatField (default = 0) U_19 = models.FloatField (default = 0) U_18 = models.FloatField (default = 0) U_17 = models.FloatField (default = 0) U_16 = models.FloatField (default = 0) U_15 = models.FloatField (default = 0) U_14 = models.FloatField (default = 0) U_13 = models.FloatField (default = 0) U_12 = models.FloatField (default = 0) U_11 = models.FloatField (default = 0) U_10 = models.FloatField (default = 0) U_9 = models.FloatField (default = 0) U_8 = models.FloatField (default = 0) U_7 = models.FloatField (default = 0) U_6 = models.FloatField (default = 0) U_5 = models.FloatField (default = 0) -
How to send data from ESP8266 to Django local server
I am new to Django and even newer to ESP8266. I'm trying to send information from ESP8266 to my Django server using the POST method. The information looks like this: Temperature=24.60&Humiditi=30.30&Soil=0.00&Water=0&Light=602.00 So my ESP8266 code looks like this: #include <ESP8266WiFi.h> #include <ESP8266HTTPClient.h> #include <WiFiClient.h> #define POMPA1 D0 const char* ssid = "****"; const char* password = "*****"; String serverName = "http://127.0.0.1:8000/data/"; int POMP1 = HIGH; char output; String output_str; String payload; String server_output = "rain"; unsigned long lastTime = -20000; unsigned long currentTime = 0; unsigned long remeberedTime = 0; int timeDelay = 20000; void setup() { // Open serial communications and wait for port to open: Serial.begin(9600); pinMode(POMPA1, OUTPUT); WiFi.begin(ssid, password); Serial.println("Connecting"); while (WiFi.status() != WL_CONNECTED) { delay(2000); Serial.print("."); Serial.println(""); Serial.print("Connected to WiFi network with IP Adress: "); Serial.println(WiFi.localIP()); Serial.print("DNS IP: "); Serial.println(WiFi.dnsIP()); } while (!Serial) { ; // wait for serial port to connect. Needed for native USB port only } } void loop() { // run over and over if (Serial.available()) { output_str = Serial.readString(); Serial.println(output_str); if (WiFi.status() == WL_CONNECTED) { HTTPClient http; http.begin(serverName); http.addHeader("Content-Type", "application/x-www-form-urlencoded"); int httpCode = http.POST(output_str); payload = http.getString(); Serial.println(httpCode); Serial.println(payload); http.end(); } else { Serial.println("Server Disconnected"); } } Serial.println(payload); if (payload=="pompa1"){ currentTime … -
I have a python django app that was working fine until Pylance was automatically installed. Now I get an error: Exception has occurred:
My code is: from django.shortcuts import render # Create your views here. from django.views.generic import ListView # <- new from .models import Post def home(request): context = { 'posts': Post.objects.all() } return render(request, 'blog/home.html', context) And the error I receive is from .models import Post Exception has occurred: ImportError attempted relative import with no known parent package Post is defined in: from django.db import models # Create your model fields here. from django.utils import timezone # for the DateTimeZone field below from django.contrib.auth.models import User # the author field below needs this class Post(models.Model): title = models.CharField(max_length=100) content = models.TextField() # TextField has no length limitation date_posted = models.DateTimeField(default=timezone.now) # Use the django timezone author = models.ForeignKey(User, on_delete=models.CASCADE) # if the User is deleted, so will this model def __str__(self): return self.title Any help would be appreciated. -
TemplateDoesNotExist on Django 3.2.2
I am getting the below error when, I am trying to add new application: TemplateDoesNotExist at /listings/ listings/listings.html Request Method: GET Request URL: http://127.0.0.1:8000/listings/ Django Version: 3.2.2 Exception Type: TemplateDoesNotExist Exception Value: listings/listings.html Exception Location: /home/brup/Desktop/Python/Django/FullWebApplication/btre_project/venv/lib/python3.6/site-packages/django/template/loader.py, line 19, in get_template Python Executable: /home/brup/Desktop/Python/Django/FullWebApplication/btre_project/venv/bin/python Python Version: 3.6.9 Python Path: ['/home/brup/Desktop/Python/Django/FullWebApplication/btre_project', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/home/brup/Desktop/Python/Django/FullWebApplication/btre_project/venv/lib/python3.6/site-packages'] Note: I have gone through these links but its not helping me, I have checked these. I have added pages application and its working fine, but when I am trying to added listing application its not working. Solution1 Solution2 Solution3 TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] Inside Installed Apps, I have done the the following: INSTALLED_APPS = [ 'pages.apps.PagesConfig', 'listings.apps.ListingsConfig', 'realtors.apps.RealtorsConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', ] In urls.py I have added the following: from django.contrib import admin from django.urls import path, include urlpatterns = [ path('', include('pages.urls')), path('listings/', include('listings.urls')), path('admin/', admin.site.urls), ] Listing Application: Configuring urls.py in listing from django.urls import path from . import views urlpatterns = [ path('', views.index, name='listings'), path('<int:listing_id>', views.listing, name='listing'), path('search', views.search, name='search'), ] configuring views from django.shortcuts import render def index(request): return … -
Django(djongo) can't connect to MondoDB Atlas after Heroku deployment
I managed to get it working locally (different cluster), but not after when deployed to Heroku. Heroku - automatically adds DATABASE_URL config var with a postgresql, and I cannot remove/edit it. MongoDB Atlas - I've set the MongoDB Atlas cluster to allow IPs from everywhere. And the password has no funny characters. django settings.py DATABASES = { 'default': { 'ENGINE': 'djongo', 'NAME': 'DBProd', 'CLIENT': { 'host': "mongodb+srv://XXX:YYY@ZZZ.pc4rx.mongodb.net/DBProd?retryWrites=true&w=majority", } } } django_heroku.settings(locals()) I ran migrate straight after the deployment and it's all green OKs heroku run python manage.py migrate Everything works functional wise, just that the data are not stored in the MongoDB Atlas cluster. There are lots of posts from various sites on this, but they all have different instructions... Some of the posts I tried to follow: https://developer.mongodb.com/how-to/use-atlas-on-heroku/ Django + Heroku + MongoDB Atlas (Djongo) = DatabaseError with No Exception Connecting Heroku App to Atlas MongoDB Cloud service -- A very confused beginner -
sessionStorage.getitem returns null in react
I was making an API in django which sets a key to session of user key is then sent to email of user. I need to use this key stored in session in my react app. I used request.session.setitem method to set a temporary key in user session, but when using sessionStorage to fetch that key in react app it gives null -
How to implement suitable login form for my registration form and model User?
So, i have such model class User(models.Model): CHOICES = ( ('1', 'Author'), ('2', 'Customer'), ('3', 'Author and Customer') ) first_name = models.CharField(max_length=64, blank=False, verbose_name='') last_name = models.CharField(max_length=64, blank=False, verbose_name='') patronymic = models.CharField(max_length=64, blank=False, verbose_name='') age = models.PositiveSmallIntegerField(verbose_name='', blank=False) email = models.EmailField(unique=True, max_length=128, blank=False, verbose_name='') password = models.CharField(max_length=32, blank=False, verbose_name='') role = models.CharField(max_length=32, choices=CHOICES, default='Customer') about = models.TextField(max_length=512, verbose_name='', blank=True) and such register form class RegisterForm(ModelForm): class Meta: model = User fields = "__all__" it seems like that and my view for registration form def register(request): if request.method == 'POST': form = RegisterForm(request.POST, request.FILES) if form.is_valid(): form.save() return HttpResponse("Successfull!") else: return render(register, 'account/register.html') else: form = RegisterForm() return render(request, 'account/register.html', {'form': form}) but my login view doesn't work(it always gives me invalid data) What would be the best login view for my forms and models? -
Some user fields in Django model.py not appearing in the database after registration
I have a model for user registration. Users can successfully register and login. However, after registration some of the fields in the user model remain blank. The only fields that has the user details are the username, email and password. Other fields remain blank in the database. What could be the reason behind this? Model.py from django.db import models from django.contrib.auth.models import (AbstractBaseUser, BaseUserManager, PermissionsMixin) from django.utils.translation import gettext_lazy as _ from django_countries.fields import CountryField class CustomAccountManager(BaseUserManager): def create_superuser(self, username, email, password, **other_fields): other_fields.setdefault('is_staff', True) other_fields.setdefault('is_superuser', True) other_fields.setdefault('is_active', True) if other_fields.get('is_staff') is not True: raise ValueError( 'Superuser must be assigned to is_staff=True.') if other_fields.get('is_superuser') is not True: raise ValueError( 'Superuser must be assigned to is_superuser=True.') return self.create_user(email, username, password, **other_fields) def create_user(self, email, username, password, **other_fields): if not email: raise ValueError(_('You must provide an email adresss')) email = self.normalze_email(email) user = self.mode(email=email, username=username, **other_fields) user.set_password(password) user.save() return user class UserBase(AbstractBaseUser, PermissionsMixin): username = models.CharField(max_length=30, unique=True) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) email = models.EmailField(max_length=254, unique=True) company = models.CharField(max_length=50) country = CountryField() state = models.CharField(max_length=50) city = models.CharField(max_length=50) address = models.CharField(max_length=255, blank=True) postcode = models.CharField(max_length=50) phone_number = models.CharField(max_length=50, blank=True, unique=True) #User status is_active = models.BooleanField(default=False) is_staff = models.BooleanField(default=False) created_at = models.DateTimeField(auto_now_add=True) … -
Getting an Attribute error while trying to alter a related model on a django detailView
I have a CarRent model that is a ForeignKey to the Car model, on a CarRent detailView after payment i want to alter the CarRent model as well as the Car model, the code works well for the CarRent model, but altering the Car model results in “AttributeError at /car/requests/4/ type object 'Car' has no attribute 'object'” error class Car(models.Model): car_owner = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='car_owner', on_delete=models.CASCADE) car_model = models.CharField(max_length=20, blank=True, null=True) rented = models.BooleanField(default=False) class CarRent(models.Model): car = models.ForeignKey(Car, related_name='rented_car', on_delete=models.CASCADE) driver = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='driver_renting', on_delete=models.CASCADE) active_rent = models.BooleanField(default=False, null=True) rent_paid = models.BooleanField(default=False) @login_required @driver_required(redirect_field_name='app:home') @csrf_protect def car_rent_detail_view(request, pk): object = get_object_or_404(CarRent, id=pk) # queryset = Car.objects.get(id=pk) car_object = get_object_or_404(queryset, id=pk) paystack = PaystackAccount( settings.PAYSTACK_EMAIL, settings.PAYSTACK_PUBLIC_KEY, object.total_cost ) context = {'object': object, 'pk_public': settings.PAYSTACK_PUBLIC_KEY, 'currency': 'NGN', 'paystack': paystack, } if request.method == 'POST': if paystack.verify_transaction(request.POST['reference']): messages.success(request, "paystack payment successfull") car_rented = Car.object.get(pk=pk) car_rented.rented = True rent_activation = CarRent.objects.get(pk=pk) rent_activation.active_rent = True rent_activation.rent_paid = True rent_activation.save() messages.success(request, "Your Rent has successfully being updated") return render(request, 'app/CarRent_detail.html', context=context) Any help will be appreciated greatly. -
Jquery - after cloning div each function works only on original div not cloned div - not looping cloned div
I spent three days questioning why it is not looping my cloned Div for calculating debit and credit of my account transactions. The debit and credit total needs to added up whenever I change the input value of these fields. But when I change first row it is updating correctly. But not on subsequent rows, still showing the first record fiqure only in summary bottom debit/credit total: (That is my updatetotal() taking on first div input fields only for calculation). this is my html: {% extends 'wstore_base_generic.html' %} {% block content %} <form action="" method="post" class="w-auto" id="new_trans_form" xmlns:width="http://www.w3.org/1999/xhtml"> <div class="row mt-1 mb-4" > <div class="col-md-12"> <div> <div class="headerctr"> <h3>JV</h3> <!-- <div> --> <!-- <h3 > --> <!-- </h3> --> </div> <div class="card-body" > {% csrf_token %} <div 38rem class="row style= width:18"> <div class="col"> <label>Transaction Date</label> <input type="date" class="form-control" name="{{form.fh_dt.name}}" value=" {{current_date}}" readonly> {% if form.fh_dt.errors %} {% for error in form.fh_dt.errors %} <small class="text-danger">{{error}}</small> {% endfor %} {% endif %} </div> <div class="col-sm" > <label>Transaction Number</label> <input type="number" class="form-control" name="{{form.fh_no.name}}" value="{{transaction_number}}" readonly> {% if form.fh_no.errors %} {% for error in form.fh_no.errors %} <small class="text-danger">{{error}}</small> {% endfor %} {% endif %} </div> <div class="col"> <input type="hidden" class="form-control" name="{{form.fh_type.name}}" required readonly value="JV"> … -
Django unique together constraint in two directions
So I have some models that look like this class Person(BaseModel): name = models.CharField(max_length=50) # other fields declared here... friends = models.ManyToManyField( to="self", through="Friendship", related_name="friends_to", symmetrical=True ) class Friendship(BaseModel): friend_from = models.ForeignKey( Person, on_delete=models.CASCADE, related_name="friendships_from") friend_to = models.ForeignKey( Person, on_delete=models.CASCADE, related_name="friendships_to") state = models.CharField( max_length=20, choices=FriendshipState.choices, default=FriendshipState.pending) So basically, I'm trying to model a Facebook-like friends situation, where there are different persons and one can ask any other person to be friends. That relationship is expressed through this last model Friendship. So far so good. But there are three situations I'd like to avoid: A Friendship can't have the same person in the friend_from and friend_to fields Only one Friendship for a set of two Friends should be allowed. The closest I've got to that, is adding this under the Friendship model: class Meta: constraints = [ constraints.UniqueConstraint( fields=['friend_from', 'friend_to'], name="unique_friendship_reverse" ), models.CheckConstraint( name="prevent_self_follow", check=~models.Q(friend_from=models.F("friend_to")), ) ] This totally solves situation 1, avoiding someone to befriend with himself, using the CheckConstraint. And partially solves situation number 2, because it avoids having two Friendships like this: p1 = Person.objects.create(name="Foo") p2 = Person.objects.create(name="Bar") Friendship.objects.create(friend_from=p1, friend_to=p2) # This one gets created OK Friendship.objects.create(friend_from=p1, friend_to=p2) # This one fails and raises an IntegrityError, which … -
Can't Activate Virtualenv on Powershell
I'm trying to learn Django. To start, I needed to install Python, Django, and Virtualenv. These are all installed with no errors. But now that I want to start a project and run virtualenv, I can't activate it in the powershell. I used this command to make a virtualenv: python -m virtualenv venv Now the tutorial says that I have to activate virtualenv like this: . \scripts\activate but it gives me this error: . : The term '\scripts\activate' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:3 + . \scripts\activate + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (\scripts\activate:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException What should I do? -
Filed to load resource: the server responded with a status of 404 (Not Found)
My images are not loading in a template. I was placing them in admin, so everything should be ok but,no. Model field class Guide(models.Model): image = models.ImageField(upload_to='users/%Y/%m/%d/', blank=True) settings.py STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATIC_URL = "/static/" MEDIA_URL = '/trips/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'trips/media/') Project tree Template {% if item.image%} <img src="{{item.image.url}}" alt="" style="max-height:300px"> {%else%} <img src="{%static 'avatar_sample.png' %}" id="uploaded_image" class="img-responsive img-circle" /> {%endif%} -
I am working on a React Django project I want to integrate opencv webcam django into react webcam so that the feed from the react js goes to opencv
This topic has some limited resources I am working on this React Django Project a real time face detection project I am using react in frontend with django backend and I have connected django with react my django opencv live webcam is working fine but how to connect opencv webcam with react webcam or any way to show the opencv webcam live on react js front page please help if anyone has some resources or links. -
Django Model conditional Validations
i have made an api on which a customer is sending his/her details for payment by making post request, so need to validate this data on model level,How can i validate a model field by comparing it to the other model fields For example: models.py Orders(models.Model): amount = models.DecimalField(max_digits=19, decimal_places=4) currency = models.CharField(max_length=3,choices=[('INR','INR')]) more choices are to be added payee_pan = models.CharField(max_length=10) Validation required : payee_pan must be present if currency is 'INR' and amount is greater than 50000. in order to validate it i am using model.full_clean() while saving the the model object in views.py views.py try: orders.full_clean() except ValidationError: return Response({"Error message":"invalid request body"}) else: orders.save() i would really appreciate if someone helps me in this as m stuck at this point for so long.enter code here -
Authenticate the django user using phone email and username
I am trying to achieve a login functionality like so that users can log into using their Email or Phone number or it's username as well but Django provides only email field in it's User model so that I've created an another model with One-To-One-Relation to User model and provided the phone number column but now I don't know how to achieve such functionality which I mentioned earlier. my models.py from django.db import models from django.contrib.auth.models import User class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) user_type = models.IntegerField(choices=USER_TYPE, default=3) mobile = models.BigIntegerField(unique=True) my views.py (I know it's a mess but I can't figure out how to have such functionality) def login(request): if request.method == "POST": username = request.POST['username'] password = request.POST['password'] user = auth.authenticate(username=username, password=password) if user is not None: auth.login(request, user) messages.success(request, 'You are logged in successfully!') return redirect('/dashboard') else: user = auth.authenticate(profile_phone=username, password=password) if user is not None: auth.login(request, user) messages.success(request, 'You are logged in successfully!') return redirect('/dashboard') else: user = auth.authenticate(email=username, password=password) if user is not None: auth.login(request, user) messages.success(request, 'You are logged in successfully!') return redirect('/dashboard') else: messages.error(request, 'Invalid username or password') return redirect('/login') else: if request.user.is_authenticated: messages.success(request, 'You are already logged in') return redirect("/dashboard") return render(request, … -
How can I send a reset password email on Django?
During the process of creating my first website using Django framework, I encountered a little problem that I couldn't found a solution yet. So, when an user wants to reset his or her password, i'd like to send to him/her a reset mail. So far, I have this: urls.py from django.contrib.auth import views as auth_views ...... path('password-reset/', auth_views.PasswordResetView.as_view(template_name='registration/password_reset_form.html'), name='password_reset'), path('password-reset-confirm/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view(template_name='registration/password_reset_confirm.html'), name='password_reset_confirm'), path('password-reset/done/', auth_views.PasswordResetDoneView.as_view(template_name='registration/password_reset_done.html'), name='password_reset_done'), path('password-reset-complete/', auth_views.PasswordResetCompleteView.as_view(template_name='registration/password_reset_complete.html')), .... settings.py EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" EMAIL_HOST = 'smtp.gmail.com' EMAIL_POST = 587 EMAIL_USE_TLS = True EMAIL_HOST_USER = os.environ.get('traces_email') EMAIL_HOST_PASSWORD = os.environ.get('traces_email_password') I created a token generator for my link: token_generator.py from django.contrib.auth.tokens import PasswordResetTokenGenerator import six class TokenGenerator(PasswordResetTokenGenerator): def _make_hash_value(self, user, timestamp): return ( six.text_type(user.pk) + six.text_type(timestamp) + six.text_type(user.is_active) ) account_activation_token = TokenGenerator() When I go through the reset flow, it does not send any email. It is still sent to my terminal. Can somebody help me with this issue? Thank you so much for your time!