Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django: how to order a queryset by a related object if it exists and by a field if it doesn't?
I have two models: class Product(models.Model): name = models.CharField(max_length=200, blank=False) price = models.DecimalField(max_digits=100, decimal_places=2, blank=False) class Meta: verbose_name = 'product' verbose_name_plural = 'products' class PromotionPrice(models.Model): product = models.ForeignKey(Product, related_name='promotion_prices', on_delete=models.CASCADE, null=False) price = models.DecimalField(max_digits=100, decimal_places=2, blank=False) start_date = models.DateTimeField(blank=False) end_date = models.DateTimeField(blank=False) class Meta: verbose_name = 'promotion price' verbose_name_plural = 'promotion prices' I want an efficient way to order all the Product objects by the price, taking into account the promotion price if it exists. E.g. I have the following list of Product objects: [ { id: 1, name: "Apple", price: "5.00", promotion_prices: [] }, { id: 2, name: "Banana", price: "10.00", promotion_prices: [] }, { id: 3, name: "Orange", price: "15.00", promotion_prices: [ { product: 1, price: "9.00", start_date: "2021-03-20T00:00:00Z", end_date: "2021-03-20T00:00:00Z" } ] } ] I want the result of ordering to be "Apple", "Orange", "Banana", because "Orange" has a promotion price on it. I'm dealing with thousands of objects, so sorting using sorted() takes ages. -
Best way to save all actions in an application with Django
I would like to save all actions that my staff doing in my application. I could save a report when all function are called, however, I want to save all the actions that was doing in this function. For example, if you update one field in some form, I would like to save what forms are updated. What is the best way to do it? Manual? Is there some library that help me to do it? I did not find any. I read about Django Signals but I think that is not the way. I can save a report when my models are saved, but I do not know exactly if it is going to save all my requirements and to be honest, I do not know how it working correctly. class somemodel(admin.ModelAdmin): ........ def save(self, *args, **kwargs): super().save(*args, **kwargs) ...do whatever for save the actions... -
How to expand accordian with url in Django template
I'm adding some FAQs to our product pages with the use of a Bootstrap (v5) accordian. If asked a question by a potential client in an email, I want to be able to send them the URL that takes them directly to the answer and expands the accordian item. Each FAQ is loaded from a Django model. The ID from each FAQ is the variable I want to use for each accordian item. I've looked at some other answers on here but can't seem to figure out how to write the script needed for my specific use case. I know nothing about JQuery so haven't included scripts I've found while searching for the answer as they're likely unhelpful. This is my HTML: <section class="bg-white" style="padding: 3rem"> <div class="container"> {% if faqs %} {% for service in services %} {% with name=service.0 %} <h3>{{ name }}</h3> <hr> <!----------------------- ACCORDIAN ------------------------------------------------------------> <div class="accordion accordion-flush mb-3" id="accordionFaq-{{ name }}"> {% for q in faqs %} {% if q.related_service|lower == name|lower %} <div class="accordion-item"> <h3 class="accordion-header" id="faq-heading-{{ q.id }}"> <a class="accordion-button collapsed" data-bs-toggle="collapse" href="#faq-{{ q.id }}" aria-expanded="false" aria-controls="faq-{{ q.id }}"> {{ q.question }} {{ q.id }} </a> </h3> <div id="faq-{{ q.id }}" class="accordion-collapse collapse" … -
Django and Node.js integration
I'm trying to create a python/Django project and in that project, I want to integrate a video calling module. But I am just creating this project for my semester project, in short, using localhost. I have searched many API's but some of them require purchasing and others don't support the Django framework. However, I found one Node.js code, but I don't know how to integrate it with Django. Can anyone please help me out that how I can integrate video calling into my Django project? Most recently I found Twilio, but it has node js code. please let me know how can I integrate it in my Django project. Thank you. -
Django: How to make Id unique between 2 different model classes
Im working on a problem that requires 2 different models to have unique Ids. So that an instance of ModelA should never have the same id as a ModelB instance. For example, What would be the Django way of making sure these two model types wont have overlapping Ids? class Customer(models.Model): name = models.CharField(max_length=255) class OnlineCustomer(models.Model): name = models.CharField(max_length=255) -
Django Post error: 'User' object has no attribute 'profile' issue at views.py
I think this error message has been posted in stackoverflow before, but even looking at the other posts I still cannot see why I am still getting this error. I am really running out of ideas on how to solve this (I am a bit new to Django too) so if anyone can give me a helping hand it would be much appreciated! my code: models.py (this was properly indented in my IDE, I just cannot get this properly done in this post): class Helper(models.Model): user = models.OneToOneField(User, unique=True, related_name='profile',on_delete=models.CASCADE) phone_regex = RegexValidator(regex=r'^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$') phone = models.CharField(validators=[phone_regex], max_length=17) STATUS = ( ('Available', ('I am available to help.')), ('Not Available', ('Busy right now')), ) availability = models.CharField(choices=STATUS, default='Available', max_length=222) Verification = ( ('Yes', ('Verified.')), ('No', ('Not Verified')), ) verified = models.CharField(choices=Verification, default='No', max_length=222) def __str__(self): return f'Helper: {self.user.username}' def save(self, *args, **kwargs): super().save(*args,**kwargs) @receiver(post_save, sender=User) def create_user_profile(sender, instance, created, **kwargs): if created: Helper.objects.create(user=instance) @receiver(post_save, sender=User) def save_user_profile(sender, instance, **kwargs): instance.profile.save() forms.py: class UserCreateForm(UserCreationForm): class Meta: fields = ["username", "first_name", "last_name","email", "password1", "password2"] model = User class HelperCreateForm(forms.ModelForm): class Meta: model = Helper fields=('phone','availability') views.py (this was properly indented in my IDE, I just cannot get this properly done in this post): def … -
Django Migration - Migration missing some fields
This is an easy exercise, i'm a beginner about models and migration Models.py from django.db import models # Create your models here. class Flight(models.Model): origin = models.CharField(max_length=64), destination = models.CharField(max_length=64), duration = models.IntegerField() Then i'm going on my prompt and type python manage.py makemigrations and in migrations/0001_initial.py # Generated by Django 3.1.7 on 2021-03-23 16:19 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='Flight', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('duration', models.IntegerField()), ], ), ] How u can see origin and destination don't migrate How can i fix it? -
Locking out button using python
I have a django app and what i want to do is when a html button is pressed i want to have a pop up window locking out the current page saying "Assignment submitted". I want the user to be able to be able to submit again at the begining of each new day. so hence only being able to click the submit button once a day. I know i will have to use the datetime function to access the current day and lock the site out until tomorrow. Any one know any handy tutorials or things i should look up? <input type="button" value="submit" onclick="window.open('submit')"> I guess the cleanest way is to incorporate this locking out functionality in my submit python function in main.py file. -
conversion of datetime Field to string in django queryset.values_list()?
my code: from django.db.models import TextField from django.db.models import F, Func, Value, CharField qs=People.objects.annotate( formatted_date=Func( F('create_time'), Value('%Y-%m-%d %H:%M:%S'), function='to_char', output_field=TextField() ) ).values('create_time').first() print(qs) but get data is {'create_time': datetime.datetime(2021, 2, 16, 15, 58, 10, 305730, tzinfo=<UTC>)} i want to data is {'create_time': "2020-12-02 17:12:12"} my used database is mysql -
How to create an object of type rest_framework.request.Request to perform a get request?
I have a get method that is supposed to perform a GET request. I also have a put method that is supposed to perform a PUT request. For what I need to do I'm trying to call the get method inside the put method before any logic happens. Parts of the code is shown below: def get(self, request, pk, format=None): ... ... return Response(data, status=status.HTTP_200_OK) def put(self, request, pk, format=None): print(type(request)) self.get(request,pk) //This is the line that I'm having trouble with. ... ... return Response(data, status=status.HTTP_200_OK) The problem I'm facing is I'm not sure how to construct the data for the request parameter. Using postman to send a request, when I print the type of request I get <class 'rest_framework.request.Request'>. And when I print request itself I get <rest_framework.request.Request: PUT '/core/test/34500994/'>. I can't seem to find docs on rest_framework.request.Request. How do I create a rest_framework.request.Request object that is for a GET request that I can use as an arguement for the put method? -
Image in web browser not getting rendered
Image in web browser not getting rendered, showing alt attribute's message, I am using Django's lightweight server not only that but the image is not visible even in simple static html file but it is getting rendered when it's address in pasted in browser's search bar My code something looks like HTML file <!DOCTYPE html> {% load static %} <html lang="en"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> {% for prod in allProds %} {{prod.name}}<br> <img src="/media/{{prod.img}}"><br> {{prod.img}} {{prod.smdesc}}<br> {{prod.bgdesc}} <br> {% endfor %} </body> </html> models.py from django.db import models import uuid from django.contrib.auth.models import User # Create your models here. class Category(models.Model): category = models.CharField(max_length=50) class SubCategory(models.Model): sub_category = models.CharField(max_length=50) class Product(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) name = models.CharField(max_length=40) img = models.ImageField(upload_to='shop/images') smdesc = models.CharField(max_length=100) bgdesc = models.CharField(max_length=400) price = models.IntegerField() in_Stock = models.IntegerField(default=0) discount = models.IntegerField(default=0) category = models.ForeignKey(Category, on_delete=models.CASCADE) sub_category = models.ForeignKey(SubCategory, on_delete=models.CASCADE) date_added = models.DateField(auto_now=True) def __str__(self): return f"{self.name} of {self.price}" class Cart(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) cart_items = models.ManyToManyField(Product, blank=True, related_name="cart_items") views.py from django.shortcuts import render from .models import Product # Create your views here. def index(request): allProds = Product.objects.all() context = { 'allProds':allProds } return render(request, … -
Using a Subquery and OuterRef in a Django Annotation with unrelated models
I want to annotate all my price models with the normalized price in Dollars: class FxRate(models.Model): date = models.DateField() nominal_currency_code = models.CharField( max_length=3) value = models.DecimalField(max_digits=20, decimal_places=8) class Price(models.Model): currency = models.CharField(max_length=3, default="BIF") price_value = models.DecimalField((max_digits=20, decimal_places=8) date = models.DateField() So if today (date = 2021-03-23) the exchange rate of BIF against USD is 1900BIF/USD, I want to annotate all prices and add the price_value in USD. For that I have been trying this: from django.db.models import OuterRef, Subquery, F monthly_rate = FxRate.objects.filter( nominal_currency_code=OuterRef("currency"), date__year=OuterRef("date__year"), date__month=OuterRef("date__month") ) it assumes that currency, date in the above code refer to the values from the Price model bellow that I will be passing to the SubQUery pp = Price.objects.all().annotate(dollars_prices=Subquery(monthly_rate.values("value")[0])*F("price_value")) But whenever I run that code I'm faced with an error: ValueError: This queryset contains a reference to an outer query and may only be used in a subquery. Does OuterRef uses objects with ForeignKeys only? What am I not getting well in the SubQueries ? -
Foreign key assignment in Class based views
Basically I have a "node" detail page, from where I need to assign a new drive (for this given node - they need to be linked). The issue is to link "node" for DriveModelForm, which need to be assigned in the view. Whats wrong? All the details are below. Urls: urlpatterns = [ path('<int:pk>/drivecreate/', DriveCreateView.as_view(), name='drive-create') ] View: class DriveCreateView(CreateView): template_name = 'create_drive.html' form_class = DriveModelForm def get_success_url(self): return reverse('nodes:node-detail') def form_valid(self, form): drive = form.save(commit=False) drive.node = ?? drive.save() return super(DriveCreateView, self).form_valid(form) Model: class Drive(models.Model): manufacture = models.CharField(max_length=32) model = models.CharField(max_length=32) drive_type = models.CharField(max_length=32) capacity = models.IntegerField(default=0) node = models.ForeignKey(Node, on_delete=models.CASCADE) class Node(models.Model): name = models.CharField(max_length=32) ... many more ... Form: class DriveModelForm(forms.ModelForm): class Meta: model = Drive fields = ( 'manufacture', 'model', 'drive_type', 'capacity', ) -
How to lazy load objects in django pagination?
Is it possible to load objects on scroll in Django pagination? I want to display certain amount of posts per page and make it so that they are loaded when user scrolls down and when this "certain amount of posts per page" is reached, link to next page pops up. Is it possible? -
Gunicorn cant find the static files
By using gunicorn without nginx from digitalcloud tutorial https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#create-and-configure-a-new-django-project my server is runing and on the console is not found: /static/style.css settings.py STATIC_URL = '/static/' STATIC_ROOT = os.path.join(BASE_DIR, 'static/') I already tried to collectstatic do urlpatterns += staticfiles_urlpatterns() in urls.py file makemigrations + migrate -
Django models, how to create model which looks like json
I have problem with creating model. I don't know how to make my model looks like json file I made earlier which looks like like below. Is there way in which I can create model based on MongoDB document, or any other that will help me creating this model? { "id": 1, "zestaw": { "pytanie1": { "tresc": "Wartość\\:wyrażenia \\:x^2-5x + 90:dla \\:x= ZMIENNA1\\:", "warianty": ["1-2\\sqrt{3}", "3", "1+2\\sqrt{3}", "1-2\\sqrt{3}"], "odpowiedzi": ["3", "1", "1+2 sqrt{3}", "1-2 sqrt{3}"], "poziom trudności": 1 }, "pytanie2": { "tresc": "Liczba\\:ZMIENNA1\\:jest\\:równa", "warianty": ["\\frac{2^{25}*3^{40}}{30^{10}}", "\\frac{2^{60}*3^{40}}{36^{10}}", "\\frac{2^{50}*3^{60}}{36^{12}}", "\\frac{2^{50}*3^{40}}{36^{10}}"], "odpowiedzi": ["2^{30} * 3^{20}", "6^{45}", "6^{70}", "2^{10} * 3^{20}"], "poziom trudności": 1 } } -
How to access first made website in Django
Hi I'm new to Django so just wanted to ask if we create a website and then create another so how can we access the first website created -
Exclude fields with the same value - queryset, Django
In my project, I have Articles and User Responses that have the same value "title". I only want to find the first Articles, becouse other object have the same "title", these are the users' answers. How can I exclude objects from queryset have the same "title" parameter. I try this: q1 = Article.objects.order_by().values('title').distinct() *work good but it returns something like a list Well I try convert it to query q2 = Article.objects.filter(title__in=q1).distinct() *But it causes it to return all Repeat-Topic Articles again How to exclude objects from queryset that have the same title without changing them to a list. -
How to automatically add weekend dates when a user clicks on a page of a website?
I am making a swimming pool website where the user can check if the weekend days are available for booking a party/event. For that, there is a web page called Organize Party. Here is what I want to achieve: When the user clicks on the 'Organize Party' web page, the site queries the database for the weekend dates from 2 weeks ahead (because the booking for the party must be done 2 weeks in advance at least) to up to 8 weeks ahead. If the date does not exist beforehand, it adds those dates, and if it exists, it simply checks whether a boolean isBooked is true or not. How do I do this? I know I would have to add some python code to class index(request) in views.py , but I am not sure about what to add. -
How can I prevent a Django model that is to be deleted to access a related many-to-many object?
I have a problem with overriding a delete method for a class in Django. I have two models, which are in two separate databases. Yes, I know, Django has a problem with that. Still, except for the deletion it works so far. I have DB_A with Table_A and in it Class_A. And Class_A has a field m2m, which has a many-to-many relationship with Class_B in Table_B on DB_B. Now, when I want to delete an object (Class_B) from Table_B, Django complains that there is no intermediary (through) table on DB_B. At least to some degree I can understand this. Therefore I wanted to override that model's delete method and somehow tell Django how to manually delete the corresponding entries in the through table and otherwise just to stick to the deletion of that object in this table (B) and database (B). But I don't know how. Can you help me? -
Can't display icon in HTML <i class="{{ icon_class }}"> with Django
I'm trying to dynamically load desired icons in HTML doc. What it should look like is shown on the third div (with text ORGANISED ROUTE) result on the page To test what causes the problem I've tried three different things in each of the three div. The first one (picto_1 and text PRE-BOOKED VOUCHERS) is the actual code I expect to work and it should look like the third one with icon displayed and text under it. In seccond div (with picto_2 and AUDIO GUIDE AND MAP) I've just displayed the text from the picto_2 = models.CharField(max_length=30, default=0) field in the Model to be sure that I'll get the correct text for the icon class I want to display. As already said the third div (picto_3) is what I expect to see in the picto_1 div also. I can't figure it out why if it shows in the third div it doesen't show in the firs when it should be the same code. I'm pretty much a total noob so sorry if my first post is not written very clear. <div class="row feature_home_2"> <div class="col-md-4 text-center"> <i class="{{ discover.picto_1|default:"" }}"></i> <h3>{{ discover.icon_1_text|default:""|safe }}</h3> </div> <div class="col-md-4 text-center"> {{ discover.picto_2|default:"" }} … -
API Discord just get messages of a
I am currently working on an application in django. I have a community on Discord and I would like to get the messages of a channel on my platform. To do this, I have created the discord application. So I have my CLIENT ID, SECRET CLIENT and PUBLIC KEY. Then I developed the generation of the token, everything works it is well returned: def discord_get_token(): data = { 'grant_type': 'client_credentials', 'scope': 'identify connections messages.read' } headers = { 'Content-Type': 'application/x-www-form-urlencoded' } r = requests.post('%s/oauth2/token' % DISCORD_BASE_URI, data=data, headers=headers, auth=(DISCORD_CLIENT_ID, DISCORD_PRIVATE_KEY)) r.raise_for_status() #Token print(r.json()['access_token']) return r.json()['access_token'] And now I'm stuck, I don't want to use a bot to retrieve messages, I just want to use this route: GET /channels/{channel.id}/messages so I do my tests on postman liks this : https://discord.com/api/channels/ID_CHANNEL/messages In headers : Authorization : Bearer MY_TOKEN content-type : application/json But the message returns the error 401 Unauthorized. There is certainly some information missing but I really don't see which one if anyone can help me out thank you very much ! -
Django trying to paginated list view throws unhashable error
My view class CatListView(ListView): template_name = 'recepti/category.html' context_object_name = 'catlist' paginate_by = 4 def get_queryset(self): content = { # sendamo na template category name 'cat': self.kwargs['category'], # vse recepti tiste categorije 'posts': Recept.newmanager.filter(category__name=self.kwargs['category']) } return content And my template {% extends "recepti/base.html"%} {% block content %} <h2>{{catlist.cat|title}}</h2> {% for recept in catlist.posts%} <article class="media content-section"> <img class="rounded-circle article-img" src="{{recept.avtor.profile.image.url}}" > <div class="media-body"> <div class="article-metadata"> {% if recept.avtor.is_staff %} <a class="mr-2" href="{% url 'user-recepti' recept.avtor.username%}">{{ recept.avtor }}</a><i class="fas fa-check-circle"style="color:#7CFC00;"></i> {% else %} <a class="mr-2" href="{% url 'user-recepti' recept.avtor.username%}">{{ recept.avtor }}</a> {% endif %} <small class="text-muted">{{ recept.datum|date:"d F, Y" }}</small> </div> <h2><a class="article-title" href="{% url 'recept-detail' recept.id %}">{{ recept.naslov }}</a></h2> <p class="article-content">{{recept.sestavine }}</p> <p class="article-content">{{ recept.priprava}}</p> </div> </article> {% endfor %} {% if is_paginated %} {%if page_obj.has_previous %} <a class ="btn btn-outline-info mb-4" href="?page=1">First</a> <a class ="btn btn-outline-info mb-4" href="?page={{page_obj.previous_page_number}}">Previous</a> {% endif %} {% for num in page_obj.paginator.page_range %} {% if page_obj.number == num %} <a class ="btn btn-info mb-4"btn-info mb-4 href="?page={{ num }}">{{ num }}</a> {% elif num > page_obj.number|add:'-3' and num < page_obj.number|add:'3' %} <a class="btn btn-outline-info mb-4" href="?page={{ num }}">{{ num }}</a> {% endif %} {% endfor %} {%if page_obj.has_next %} <a class="btn btn-outline-info mb-4" href="?page={{page_obj.next_page_number}}">Next</a> <a class ="btn … -
Prevent Django's Unittest to overwrite Variable on model clone
i have some Unit-Tests for a Project in Django and want to Test the Model with Unit-Test. At the Test for cloning an Model my variable get overwritten: Here an example: Django Unittest testevent = Event.objects.create(state=STATE_LIVE, name="Testname") cloned_event = testevent.clone_event() # it should be 1,2 but it is 2,2 self.assertNotEqual(testevent.pk, cloned_event.pk) The Django-Model looks like this: def clone_event(self): current_pk = self.pk self.pk = None self.id = None self.save() # in between i copy some stuff i also need return self The Django-Version is 2.2.4 Thanks for help -
i am getting error while installing mysqlclient on windows 10 no library is supproted
Running setup.py clean for mysqlclient Failed to build mysqlclient Installing collected packages: mysqlclient Running setup.py install for mysqlclient ... error ERROR: Command errored out with exit status 1: command: 'c:\users\uaahacker\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\uaahacker\AppData\Local\Temp\pip-install-icjkjmap\mysqlclient_8b5f49f509624395ab7dd2c4d4a21457\setup.py'"'"'; file='"'"'C:\Users\uaahacker\AppData\Local\Temp\pip-install-icjkjmap\mysqlclient_8b5f49f509624395ab7dd2c4d4a21457\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\uaahacker\AppData\Local\Temp\pip-record-62876lx5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\uaahacker\appdata\local\programs\python\python38-32\Include\mysqlclient' cwd: C:\Users\uaahacker\AppData\Local\Temp\pip-install-icjkjmap\mysqlclient_8b5f49f509624395ab7dd2c4d4a21457 Complete output (23 lines): running install running build running build_py creating build creating build\lib.win32-3.8 creating build\lib.win32-3.8\MySQLdb copying MySQLdb_init_.py -> build\lib.win32-3.8\MySQLdb copying MySQLdb_exceptions.py -> build\lib.win32-3.8\MySQLdb copying MySQLdb\connections.py -> build\lib.win32-3.8\MySQLdb copying MySQLdb\converters.py -> build\lib.win32-3.8\MySQLdb copying MySQLdb\cursors.py -> build\lib.win32-3.8\MySQLdb copying MySQLdb\release.py -> build\lib.win32-3.8\MySQLdb copying MySQLdb\times.py -> build\lib.win32-3.8\MySQLdb creating build\lib.win32-3.8\MySQLdb\constants copying MySQLdb\constants_init_.py -> build\lib.win32-3.8\MySQLdb\constants copying MySQLdb\constants\CLIENT.py -> build\lib.win32-3.8\MySQLdb\constants copying MySQLdb\constants\CR.py -> build\lib.win32-3.8\MySQLdb\constants copying MySQLdb\constants\ER.py -> build\lib.win32-3.8\MySQLdb\constants copying MySQLdb\constants\FIELD_TYPE.py -> build\lib.win32-3.8\MySQLdb\constants copying MySQLdb\constants\FLAG.py -> build\lib.win32-3.8\MySQLdb\constants running build_ext building 'MySQLdb._mysql' extension error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/ ---------------------------------------- ERROR: Command errored out with exit status 1: 'c:\users\uaahacker\appdata\local\programs\python\python38-32\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\uaahacker\AppData\Local\Temp\pip-install-icjkjmap\mysqlclient_8b5f49f509624395ab7dd2c4d4a21457\setup.py'"'"'; file='"'"'C:\Users\uaahacker\AppData\Local\Temp\pip-install-icjkjmap\mysqlclient_8b5f49f509624395ab7dd2c4d4a21457\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record 'C:\Users\uaahacker\AppData\Local\Temp\pip-record-62876lx5\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\uaahacker\appdata\local\programs\python\python38-32\Include\mysqlclient' Check the logs for full command output.