Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django user information creation problem use User.objects.create_user() in the admin
I try to create user with user information like first name, last name, bio and hobby. But it show some problem on admin. On admin only show and save first name and last name but don’t show and save other field. myuser = User.objects.create_user(username,email,password) myuser.hobby = hobby myuser.first_name = fname myuser.last_name = lname myuser.bio = bio myuser.save() -
Django stops without any errors
I've set up a django echo server, used for internal uses only. because of this, I run the server with manage.py runserver & (yeh, I know, the development mode) with the & so it will keep running in the background. Lately the server always stops working without any notices or error messages. When I type jobs to see the current job, it status is Exit 247. Any idea why this happens? I looked online and no help. -
Show created and edited fields in Django admin form
I have this model class Volunteer(models.Model): STATUSES = ( ('Active', 'Active'), ('Paused', 'Paused'), ('Inactive', 'Inactive'), ) first_name = models.CharField(max_length=50) last_name = models.CharField(max_length=50) email_address = models.CharField(max_length=100, null=True, blank=True) picture = models.ImageField(null=True, blank=True) status = models.CharField(max_length=20, choices=STATUSES, default="Active") created = models.DateTimeField(auto_now_add=True, editable=False) edited = models.DateTimeField(auto_now=True, editable=False) And I register it like this class VolunteerAdmin(admin.ModelAdmin): fields = ('first_name', 'last_name', 'email_address', 'status', 'created', 'edited') list_display = ('first_name', 'last_name', 'email_address', 'status') list_editable = ('status',) list_filter = ('status',) search_fields = ('first_name', 'last_name') admin.site.register(Volunteer, VolunteerAdmin) I get an error because I have manually added the created and edited fields as I want to see them in the view/edit forms. I know that the user should not be able to change these so I set the attributes to editable=False for both. However, it throws an error. Any idea what I need to do to be able to display these two fields in my admin forms? This is my error: 'created' cannot be specified for Volunteer model form as it is a non-editable field. Check fields/fieldsets/exclude attributes of class VolunteerAdmin. Thanks for your help. -
How to make django settings file read the user model from inside a model folder instead of models.py folder
I am trying to separate the models for user from models.py to a user.py file inside model folder.The user.py is inside model folder in core app.The core app is installed in settings.py folder.Everything works fine when the User Model is in models.py.In my init.py file in models folder i have imported the model according to the docs from .user import * In my settings.py to use the custom user model i have the settings as AUTH_USER_MODEL = 'core.user' The user is the user.py file inside the model folder.When i do the migrations i get the error "AUTH_USER_MODEL refers to model '%s' that has not been installed" % settings.AUTH_USER_MODEL django.core.exceptions.ImproperlyConfigured: AUTH_USER_MODEL refers to model 'core.user' that has not been installed Help appreciated from you experts.Did searched a lot here but couldnt get this.Help please -
Internal Server Error - Django 3.0 - python3.6 - mysqlclient1.4.6 - apache2.4
I try to set up a Django application but I faced these errors. I tried to fix it but It's not working. Please tell me some ideas for resolving. Thanks a lot. myproject.conf <VirtualHost *:80> ServerName myserver DocumentRoot /var/www/EtestOnline <Directory /var/www/EtestOnline/static> Require all granted </Directory> <Directory /var/www/EtestOnline/media> Require all granted </Directory> Alias /static /var/www/EtestOnline/static Alias /media /var/www/EtestOnline/media WSGIDaemonProcess myserver python-path=/var/EtestOnline/myenv:/var/www/EtestOnline/myenv/lib/python3.6/site-packages WSGIProcessGroup myserver WSGIApplicationGroup %{GLOBAL} WSGIScriptAlias / /var/www/EtestOnline/EtestOnline/wsgi.py <Directory /var/www/EtestOnline/EtestOnline> Require all granted AllowOverride all Options FollowSymlinks <Files wsgi.py> Require all granted </Files> </Directory> ErrorLog /var/log/httpd/error.log CustomLog /var/log/httpd/access.log combined </VirtualHost> wsgi.py import os,sys from django.core.wsgi import get_wsgi_application sys.path.append('/var/www/EtestOnline') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'EtestOnline.settings') application = get_wsgi_application() error.log mod_wsgi (pid=13226): Target WSGI script '/var/www/EtestOnline/EtestOnline/wsgi.py' cannot be loaded as Python module. [Sat Jan 30 23:27:44.990735 2021] [wsgi:error] [pid 13226] [remote 14.169.251.249:55000] mod_wsgi (pid=13226): Exception occurred processing WSGI script '/var/www/EtestOnline/EtestOnline/wsgi.py'. [Sat Jan 30 23:27:44.990842 2021] [wsgi:error] [pid 13226] [remote 14.169.251.249:55000] Traceback (most recent call last): [Sat Jan 30 23:27:44.990876 2021] [wsgi:error] [pid 13226] [remote 14.169.251.249:55000] File "/var/www/EtestOnline/EtestOnline/wsgi.py", line 18, in [Sat Jan 30 23:27:44.990879 2021] [wsgi:error] [pid 13226] [remote 14.169.251.249:55000] application = get_wsgi_application() [Sat Jan 30 23:27:44.990884 2021] [wsgi:error] [pid 13226] [remote 14.169.251.249:55000] File "/var/www/EtestOnline/myenv/lib/python3.6/site-packages/django/core/wsgi.py", line 12, in get_wsgi_application [Sat Jan 30 23:27:44.990886 2021] [wsgi:error] [pid 13226] … -
Having trouble deploying my Django app on AWS
When I run "eb deploy" from the command line I get this: Uploading App/app-210130_162554.zip to S3. This may take a while. Upload Complete. 2021-01-30 16:25:55 INFO Environment update is starting. 2021-01-30 16:25:59 INFO Deploying new version to instance(s). 2021-01-30 16:26:06 ERROR Your requirements.txt is invalid. Snapshot your logs for details. 2021-01-30 16:26:09 ERROR [Instance: i-0527480e0c398a08d] Command failed on instance. Return code: 1 Output: (TRUNCATED)...) File "/usr/lib64/python2.7/subprocess.py", line 190, in check_call raise CalledProcessError(retcode, cmd) CalledProcessError: Command '/opt/python/run/venv/bin/pip install -r /opt/python/ondeck/app/requirements.txt' returned non-zero exit status 1. Hook /opt/elasticbeanstalk/hooks/appdeploy/pre/03deploy.py failed. For more detail, check /var/log/eb-activity.log using console or EB CLI. 2021-01-30 16:26:09 INFO Command execution completed on all instances. Summary: [Successful: 0, Failed: 1]. 2021-01-30 16:26:10 ERROR Unsuccessful command execution on instance id(s) 'i-0527480e0c398a08d'. Aborting the operation. 2021-01-30 16:26:10 ERROR Failed to deploy application. My requirements.txt file is as follows (ive seen some people having issues with psycopg2 but even after removing that it still doesn't work): asgiref==3.3.1 Django==3.1.5 geojson==2.5.0 psycopg2==2.8.6 pytz==2020.5 sqlparse==0.4.1 And finally, this is the error I get from the aws website: Degraded - Command failed on all instances. - Incorrect application version found on all instances. Expected version "app-210130_132526" (deployment 1). Severe - Application update failed at 2021-01-30T16:26:06Z with … -
Requests to the Django API from React are not allowed
I was introduced to web development using React and Django. As a tutorial, I was creating a to-do application. When I sent an API request from React, it was marked as Not Allowed. However, when I send the same request from curl, it is allowed. It seems that the API side is not set up properly. The code in question is shown below. import React, { useState } from "react"; import {CustomModal} from "./components/Modal"; import axios from "axios"; function App() { const [isComplete, setComplete] = useState(true); const [modal, setModal] = useState(false); const [todoItems, setToDoItems] = useState([]); const handleSubmit = (item) => { setModal(!modal); if (item.id) { axios .put(`http://localhost:8000/api/todos/${item.id}/`, item) .then(res => refreshList); } else { axios .put(`http://localhost:8000/api/todos/`, item) .then(res => refreshList); } }; const handleDelete = (item) => { axios .post(`http://localhost:8000/api/todos/${item.id}`, item) .then(res => refreshList); }; const [Item, setItem] = useState({title: "", description: "", completed: false }); const createItem = () => { const item = { title: "", description: "", completed: false }; setItem(item); setModal(!modal); }; const editItem = ( item ) => { setItem(item); setModal(!modal); }; const refreshList = () => { axios .get("http://localhost:8000/api/todos/") .then(res => setToDoItems(res.data)) .catch(err => console.log(err)); }; const displayCompleted = (status) => { if … -
Accessing a database with a different programming language
I built an app in Django, and have a script I wrote in Java that I'd like to use on the data from the Postgres database. I understand I can simply run a raw SQL query with the data in Java, but would it be more efficient to create ORM models with Java to access and process the data? More generally, if I mainly use a database with one framework, but need to access the data with another language or outside of the framework, should I build models with an ORM or use raw SQL? -
How to generate and return CSV file from pandas to django views?
I have a pandas script that takes in a CSV file, does some pandas stuff on it, and returns a new CSV file(or a response if we want that). The thing is that I want to be able to get that file in my django views.py file to be able to save it to the "converted file" database table. In short, I want to be able to store that file in a variable similar to uploaded_file = request.FILES['upload-field] I've tried various methods like returning the response but that just returns a string instead of an actual file. Also, I should mention that all of this happens when the user POSTS the data (uploads a csv file) here's my views.py from .models import ConvertedDocument def uploadView(request): if(request.method == 'POST'): uploaded_file = request.FILES['upload_field'] generated_uid = get_random_string(16) generated_name = generated_uid+".csv" actual_name = uploaded_file.name # Block to save converted file converted_file = analysis(uploaded_file) converted_file.name = generated_name converted_document = ConvertedDocument() converted_document.file_uid = generated_uid converted_document.file_name = "converted_"+actual_name converted_document.file_size = converted_file.size converted_document.file_document = converted_file converted_document.uploaded_by = user converted_document.save() return redirect('upload') return render(request, 'functions/upload.html') here's the save block from my analysis function def analysis(file): upload_df = pd.read_csv (file) # pandas conversion code goes here... response = HttpResponse(content_type='text/csv') response['Content-Disposition'] … -
Bold fonts in the label of models.IntergerField()
I am trying to let subjects input an answer to the following question and then store the answer using Django: "Your partner players in the game caught on average of 20 fish. Now how many fish you want to catch in this round?" And I use the following code: q = models.IntegerField(label="Your partner players in the game caught on average of 20 fish. Now how many fish you want to catch in this round?", min=0, max=40) Is there any way to make the number "20" bold? -
RelatedObjectDoesNotExist at /login/ while running the server locally
I using One To One field in Django to save some extra information about user but even afte migrating i got the issue which i mentioned in title my models.py the issue I got issue while running server please help if you can -
My save function is not working - I am new to Jquery
This i my first time with using jquery and i am trying to save a reply but it gives a successful message but it not actually but i cant see the reply that the system says it saved - any help will be appreciated - thank u in advance $(document).ready(function(){ $(".reply_open_modal").click(function(){ var id=$(this).parents("tr").children("td:eq(0)").text(); var name=$(this).parents("tr").children("td:eq(2)").text(); $("#reply_id").val(id); $("#reply_name").text(name); }); I think this part of my system works but i am not sure and the purpose of this code is to send the reply message $(document).on("click","#reply_btn",function(){ $(this).attr("disabled","disabled") $(this).text("Sending Reply") var id=$("#reply_id").val(); var message=$("#reply_message").val(); $.ajax({ url:'{% url 'admin_message_replied' %}', type:'POST', data:{id:id,message:message}, }) .done(function(response){ if(response=="True"){ alert("Sent") } else{ alert("Not Sent") } location.reload() }) .fail(function(){ alert("Error in Sending Reply") }) }) }) This is the fuction that saves the reply into my database but it not working @csrf_exempt def admin_message_replied(request): reply_id=request.POST.get("id") reply_message=request.POST.get("reply_message") try: messages = SendmessageAdmin.objects.get(id=reply_id) messages.message_reply = reply_message messages.save() return HttpResponse("True") except: return HttpResponse("False") -
pip installation :I am trying to install pip in my MacBook Air but it is showing syntax error : invalid syntax
Traceback (most recent call last): File "/usr/local/bin/pip", line 11, in load_entry_point('pip==21.0.1', 'console_scripts', 'pip')() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 489, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 2843, in load_entry_point return ep.load() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 2434, in load return self.resolve() File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/init.py", line 2440, in resolve module = import(self.module_name, fromlist=['name'], level=0) File "/Library/Python/2.7/site-packages/pip-21.0.1-py2.7.egg/pip/_internal/cli/main.py", line 60 sys.stderr.write(f"ERROR: {exc}") ^ SyntaxError: invalid syntax -
why object field changed in api get request?
i want test my api so i wrote test and i run my test that works well.but when i run another irrelevant get api my previous test do not work and have strange behavior When the following code is executed from another api: i see this behavior from test: and object field changed like this: can help me why did this happen and what should I do? -
How to add a verification in Django to execute a sensitive function?
In my application. I have a button that triggers an SMS blast, but yes it's something sensitive. One click then SMS blast. What I want to do is, when the user click or accidentally clicked that button, the application will ask another authentication for that specific function. (maybe ask a password again? or an OTP). How can I do that? Thanks! this is my views.py def send_sms(request): z = Test.objects.latest('timestamp') numbers = Mobile.objects.all() message = ( f'Test: ({z.timestamp.strftime("%I:%M%p %d%b%Y")}) ') account_sid = '' auth_token = '' client = Client(account_sid, auth_token) for i in numbers: client.messages.create(to=i.mobile_number, from_='', body=message) return HttpResponseRedirect('/', 200) -
name 'get_total_discount_item_price' is not defined
I'm trying to get the total price of all the items. But this error pops out whenever I try to do it. What can that due to? It says that the name is not defined even though I've written it and it should perform the task correctly. This is the HTML code: {% for object in orders %} <div class="row justify-content-start"> <div class="col col-lg-5 col-md-6 mt-5 cart-wrap ftco-animate"> <div class="cart-total mb-3"> <h3>Cart Totals</h3> <p class="d-flex"> <span>Subtotal</span> {% if object.get_total %} <span> ${{ object.get_total }}</span> </p> {% endif %} <p class="d-flex"> <span>Delivery</span> <span>$0.00</span> </p> <p class="d-flex"> <span>Discount</span> <span>$3.00</span> </p> <hr> <p class="d-flex total-price"> <span>Total</span> <span>$17.60</span> </p> </div> <p class="text-center"><a href="{% url 'core:checkout' %}" class="btn btn-primary py-3 px-4">Proceed to Checkout</a></p> </div> </div> {% endfor %} this is the models.py: class OrderItem(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) item = models.ForeignKey(Item, on_delete=models.CASCADE) ordered = models.BooleanField(default=False) quantity = models.IntegerField(default=1) def __str__(self): return f"{self.quantity} of {self.item.title}" def get_total_item_price(self): return self.quantity * self.item.price def get_total_discount_item_price(self): return self.quantity * self.item.discount_price def get_final_price(self): if self.item.discount_price: return get_total_discount_item_price() return self.get_total_item_price() class Order(models.Model): user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE) items = models.ManyToManyField(OrderItem) start_date = models.DateTimeField(auto_now_add=True) ordered_date = models.DateTimeField() ordered = models.BooleanField(default=False) def __str__(self): return self.user.username def get_total(self): total = 0 for order_item in self.items.all(): … -
Heroku Account Dashboard Issue
Hi all i am getting this error when i log into my Heroku account. Item could not be modified: Unable to fetch account It was working fine for the better part o the day any idea what would be the cause? -
How to change url in Django
I am new to Django and maybe formulation of the question is not the best, so sorry for that. I am trying to implement a search functionality and it seems to work fine, except it is not matching the path. I want it to look like this after I click submit button: 'search/query=value', but I get this instead: '/ru/”/ru/search/”?csrfmiddlewaretoken=SSoBp5K7E0EgRFQNyIvECSXFohG5ACp9IKNGKXMOYNmdc8BqqHeKLR8vawHuVxwf&”txtSearch”=1'. I am using i18n to prefix paths with language. Here is code that relevant to the problem: urls.py urlpatterns = [ path('', HomeView.as_view(), name='home'), path('search/', search, name='search'), ] home.html <form id=”search” method=”GET” action=”{% url 'search' %}”> <input type=”text” id=”txtSearch” name=”txtSearch”> <button type=”submit”>Submit</button> </form> views.py def search(request): if request.method == 'GET': query = str(request.GET['”txtSearch”']) print(query) queryset = [] queries = query.split(' ') for q in queries: print(q, 'is q') articles = Article.objects.filter( Q(name__icontains=q) | Q(body__icontains=q) ).distinct() for article in articles: queryset.append(article) return render(request, 'search.html', {'articles': list(set(queryset))}) Thank you! -
Django Rest Framework + psycopg2 : InterfaceError: cursor already closed
I have a problem with psycopg2. It fails to perform some queries. I have traced exceptions and it says: django.db.utils.InterfaceError: cursor already closed I have already seen some similar cases on the Internet, tried all the recommendations, but no luck. I use Django Rest Framework, and while requesting some endpoints it causes error, just in some requests. I monitored error.log file and I see 15-20 requests failed with HTTP 500 error. Is there any solutions for this problem? Software Versions: djangorestframework == 3.12.1 django == 3.0.5 Python 3.8 This is uswgi.ini file which I run on the server. Socket is used by NGINX. [uwsgi] project = DjangoProject base = /opt/django-project chdir = %(base) module = %(project).wsgi:application home = %(base)/venv gid = www-data uid = www-data master = true processes = 5 socket = /tmp/%(project).sock chmod-socket = 664 vacuum = true harakiri = 60 max-requests = 10000 I tried to solve problem by increasing connections to Postgresql. But no change, the error still remains. Snippet from postgresql.conf file: max_connections = 2000 shared_buffers = 800MB Complete stack trace: Internal Server Error: /api/users/ Traceback (most recent call last): File "/opt/django-project/venv/lib/python3.8/site-packages/django/db/utils.py", line 97, in inner return func(*args, **kwargs) psycopg2.InterfaceError: cursor already closed The above … -
Adding custom usercreationform attributes to admin panel
I have extended the default user creation form and added some custom attributes but they are not showing up in the admin site, can someone let me know how to register them in the admin panel. from django.contrib.auth.forms import UserCreationForm from django.contrib.auth.models import User from django import forms class UserCreate(UserCreationForm): full_name = forms.CharField(max_length=200) channel_name = forms.CharField(max_length=200) email = forms.EmailField() class Meta: model = User fields = ["username", "email", "password1", "password2", "full_name", "channel_name"] def save(self, commit=True): user = super(UserCreate, self).save(commit=False) user.full_name = self.cleaned_data["full_name"] user.channel_name = self.cleaned_data["channel_name"] user.email = self.cleaned_data["email"] if commit: user.save() return user -
How to configure crontab to run Django command?
I run a Debian 10 system have the following shell file named "update.sh": #!/bin/bash cd home/user/djangoprojet source /env/bin/activate python manage.py update I run a root user and set "chmod +x update.sh". When I run "home/user/djangoprojet/update.sh", executing the script works perfectly. I now used "crontab -e" to run the script every minute: * * * * * home/user/djangoprojet/update.sh > testcron.log However, the script is not executed. When I run "grep CRON /var/log/syslog", I get the following result, which indicates that crontab runs: Jan 30 15:08:01 vServer CRON[22036]: (root) CMD > (home/user/djangoprojet/update.sh > testcron.log) Jan 30 15:08:01 vServer CRON[22035]: (CRON) info (No MTA installed, discarding output) The "testcron.log" file, located in the root directory, is empty - although the script would generate an output, if it ran. Somewhere on StackExchange I also found to execute this command /bin/sh -c "(export PATH=/usr/bin:/bin; home/user/djangoprojet/update.sh </dev/null)" which works perfectly. How can I configure crontab correctly such that my script runs? Thanks! -
Show private content to specific users in Django
I'm building a very simple website where a user authenticates and accesses a personal page from where they can download their paychecks. I've already implemented the login view, that redirects the user to the profile page. Now in the profile page, I need to add a list of paychecks to download. In order to do that, I need to take them from a static sub-directory with the same name as the user: static/paychecks/username I've been reading about serving static files, but I can't figure out how to do this specifically. Any help will be much appreciated. -
How to pass field from submitted form into url in Django?
I am trying to submit a form, save to database and then show the cleaned_data on a new url. In the form I have a field called job_number. I would like to send the cleaned_data over to 127.0.0.1:8000/quotes/job_number quote/views.py: @login_required def quote_view(request): data_form = QuoteInformationForm() if request.method == "POST": data_form = QuoteInformationForm(request.POST) if data_form.is_valid(): data_form.save(commit=True) return redirect('quote') else: print('Error') return render(request, "index.html", {'data_form': data_form}) @login_required def submitted_quote(request): return render(request, "quote.html") urls.py: urlpatterns = [ path('home/', quote_view, name='home'), path('quote/', submitted_quote, name='quote'), Currently all this does is open the form at http://127.0.0.1:8000/home/ using index.html. When I submit it will send the info to the database and redirect me to http://127.0.0.1:8000/quotes. This is fine. Now I just need to show the cleaned data on this url and change the url to include the job_number at the end. How can I do this? -
Django model serialization returns only primary key for foreign key
i am building blog site with Django. After serialization, the Post model which has a foreign key field of Django built-in User model, Post models are returned with the integer foreign key reference to the User model while i am expecting the whole User object data rather only getting the integer number. the Post models.py: from django.db import models from django.contrib.auth.models import User class Post(models.Model): author = models.ForeignKey(User,on_delete=models.CASCADE) body = models.TextField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) the serializers.py: from rest_framework import serializers from .models import Post class PostSerializer(serializers.ModelSerializer): class Meta: fields = ('id', 'author','body','created_at') model = Post the views.py: from django.shortcuts import render from rest_framework import generics from .models import Post from .serializers import PostSerializer from .permissions import IsAuthorOrReadOnly class PostList(generics.ListCreateAPIView): serializer_class = PostSerializer queryset = Post.objects.all().order_by('-created_at')#sorted by created_at descending class PostDetail(generics.RetrieveUpdateDestroyAPIView): permission_classes = (IsAuthorOrReadOnly,) serializer_class = PostSerializer queryset = Post.objects.all() i want { "id": 15, "author": {"fisrt_name":"firstname","last_name":"namelast","username":"username1","email":"example@gamil.com"}, "body": "hello world2", "created_at": "2020-12-23T13:53:17.741635Z" } instead of { "id": 15, "author": 21, "body": "hello world2", "created_at": "2020-12-23T13:53:17.741635Z" } -
Hello, I have a problem with submiting a form in django
I have tried to create a simple form of registration with 'POST' method, and then at 'views.py' I tried this: from django.shortcuts import render,redirect from django.contrib.auth.models import User,auth # Create your views here. def register(request): if request.POST: first_name = request.POST["first_name"] last_name = request.POST["last_name"] username = request.POST["username"] email = request.POST["email"] password = request.POST["password1"] password2 = request.POST["password2"] user = User.objects.create_user( username=username, password=password, email=email, first_name=first_name, last_name=last_name ) user.save() return redirect("/") else: return render(request, "register.html") to prevent the page from going to the same url again like '..../register/register' since i have been using the same file 'register.html' for submiting data and fetching the page : <form action="register" method="post"> {%csrf_token%} <br> First_Name : <br> <input type="text" maxlength="30" placeholder="First Name" name="first_name" required> <br> Last_Name : <br> <input type="text" maxlength="30" placeholder="Last Name" name="last_name" required> <br> User_Name : <br> <input type="text" maxlength="30" placeholder="User Name" name="username" required> <br> Email : <br> <input type="email" placeholder="Email" name="email" required> <br> Password :<br> <input type="password" maxlength="30" placeholder="Password" name="password1" required> Confirm_Password :<br> <input type="password" maxlength="30" placeholder="Confirm Password" name="password2" required> <hr> <input type="submit"> </form> this is my project file urls : from django.contrib import admin from django.urls import path,include from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('', include('website.urls')), path('accounts/', include('accounts.urls')), path('admin/', …