Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
Django ORM: migrate composite foreign key from 2 to latest version of django
Have limited experience with django orm, there is a project with legacy django version (2.2) and I need to migrate it to the latest one (4.1). Cannot understand, what is modern concept of something called CompositeForeignKey and CompositeOneToOneField, which was before imported from 3d party module django-composite-foreignkey (this module doesn't support django orm above version 2). So what I need is to create foreign key of multiple fields to another table. Below is example of existing definition of such composite key. from compositefk.fields import CompositeForeignKey ... # my model... study_country = CompositeForeignKey( 'StudyCountry', on_delete=models.DO_NOTHING, to_fields={'study': 'study', 'country': 'country'} ) Is there any simple way how to migrate such a code to new django orm? p.s. any raw SQL cannot be a solution in my case for specific reasons. -
Django Large File Serving
I am trying to make an app like youtube, where I need to serve huge number of files and each Video file size can be large [ 50MB or 1GB, or 2GB or more]. I am using SQLite DataBase. How can I serve these files in an efficient way? models.py class VideoContent(models.Model): contenttitle = models.CharField(max_length=300, blank=False) file = models.FileField(blank=False, verbose_name='Your Video Content', validators=[FileExtensionValidator( allowed_extensions=['MOV', 'avi', 'mp4', 'webm', 'mkv'] )]) uploaded = models.DateTimeField(auto_now_add=True) updated = models.DateTimeField(auto_now=True) def __str__(self) -> str: return self.contenttitle.title() ** views.py ** class VideoContents(ListView): template_name = 'contents/index.html' context_object_name = 'videos' ordering = '-uploaded' model = VideoContent # def get_queryset(self): # return VideoContent.objects.all() -
Is there a way to pick variable name for msgid in django translation?
I am currently relying on django translations and I am curious to know if there is a way to pick msgid for translation based on a variable name For instance: name = _("Some Name") msgid "name" msgstr "Some Name" I want the msgid to match the variable name automatically when django picks up the variable but cannot find a way through the documentation. -
Django Signals not triggering when only using apps.py
Here I want to create a Datalog when a new Customer create an account. I want to trigger the Datalog event and save the relevant information into the Datalog table. apps.py (I could write in signals.py but I prefer to write it into directly app.py) from django.db.models.signals import post_save, post_delete from django.dispatch import receiver from .models import DataLog class LogAPIconfig(AppConfig): default_auto_field = 'django.db.models.BigAutoField' name = 'myapp' def ready(self): @receiver(post_save, sender=DataLog) def log_save_actioner(sender, created,instance, **kwargs): print("signal is sent to heatmap") action = 'create' if created else 'update' Datalog.objects.create( heatmap_type = instance.heatmap_type, status = instance.status, action = action, sender_table = sender.__name__, timestamp = instance.timestamp ) models.py class Customer(models.Model): Customer_name = models.ForeignKey(User, unique=True, primary_key=True, related_name="Customer_name") Customer_type = models.CharField(max_length=255) class Datalog(models.Model): Customer_name = models.ForeignKey(Customer, on_delete=models.CASCADE) status = models.CharField(max_length=255) comment = models.TextField(null=True, blank=True) followUpDate = models.DateTimeField(auto_now_add=True) class Meta: ordering = ['-followUpDate'] def __str__(self): return str(self.status) settings.py INSTALLED_APPS = [ "django.contrib.admin", "django.contrib.auth", "django.contrib.contenttypes", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "rest_framework", "rest_framework.authtoken", "corsheaders", "django_auth_adfs", "django_filters", 'myapp.apps.LogAPIconfig', ] When I implemented this I got following error message in the terminal django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. after some search I think this is somewhat related with importing Datalog table. I want to know Is this something related because of I'm not using … -
Django - Static Files not loading
I am trying to make a Django application, and because I am very new to the process, I have been having a few issues doing it without tutorials, I have used Google and SO the whole way so far, here is my error, I am trying to load my static files, when i do that i get the following error: So upon further research, I have entered the correct information as requested, please see my: settings.py CLOUDINARY_STORAGE = { 'cloud_name': 'xxx', 'api_key': 'xxx', 'api_secret': 'xxx', } # STATIC_ROOT = os.path.join(BASE_DIR, 'static') STATIC_URL = '/static/' STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static'),] STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_STORAGE = 'cloudinary_storage.storage.StaticHashedCloudinaryStorage' Then when I add it to the index.html template, I have done so like this: index.html {% load static %} <!DOCTYPE html> <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>Landing Page</title> {% comment %} Bootstrap {% endcomment %} <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-+0n0xVW2eSR5OomGNYDnhzAbDsOXxcvSN1TPprVMTNDbiYZCxYbOOl7+AMvyTG2x" crossorigin="anonymous"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-gtEjrD/SeCtmISkJkNUaaKMoLD0//ElJ19smozuHV6z3Iehds+3Ulb9Bn9Plx0x4" crossorigin="anonymous"> </script> <link rel="stylesheet" href="{% static 'css/style.css' %}"> <script>alert('this works');</script> </head> I know I should run a collect static command at some point so when I do that i get the following error: which is just the same issue on the rendered template: Please … -
django / filter the fields of a form ane have the error 'int' object has no attribute '_meta'
on django and I have a small problem of novice if someone can guide me I will be grateful I use django-cities-light for a travel website and I would like to filter the cities in the fields ville_de_depart and ville_destination in the newBookingForm by trip.depart and trip.destination. I tried to pass the trip object in the instance of newBookingForm i override the init and I took the value of the depart and destination, I succeeded in filtering the fields but I could no longer save the newBooking, the view redirect to the alltrip page with no error but no new booking in the database I tried to replace the trip by the slug which is the same value as the id and it shows me this error 'int' object has no attribute '_meta' I searched a lot and it really tired me I can't find a solution to filter the tow fields without having any issue if anyone can help me I will be grateful models.py class trip(models.Model): depart = models.ForeignKey(default='',to=Country,on_delete=models.CASCADE,related_name='depart') destination = models.ForeignKey(default='',to=Country,on_delete=models.CASCADE) date_de_depart = models.DateField(default='') prix_kg = models.PositiveIntegerField(default='') collecte = models.BooleanField(default=False,null=False,help_text='' ) creation_date = models.DateTimeField(auto_now=True) author = models.ForeignKey(to=settings.AUTH_USER_MODEL,on_delete=models.CASCADE,default='') slug = models.SlugField(max_length=100, default='' ) #jouter slug def save(self, *args … -
How to return the user ID in HTTP response after a user log in with DRF token authentification?
My application has a /login endpoint where users can enter their login information, and after a user has been authenticated I would like to display a DRF view based on it's user ID as a parameter in the URL. What is the best way to do that ? Shall I need to include the user ID into the HTTP response and if so, how to do that ? This is how the login view and serializer look like : view.py class LogInView(TokenObtainPairView): serializer_class = LogInSerializer serializer.py class LogInSerializer(TokenObtainPairSerializer): @classmethod def get_token(cls, user): token = super().get_token(user) user_data = ManagerSerializer(user).data for key, value in user_data.items(): if key != 'id': token[key] = value return token The view I would like to display after the user login looks like this : view.py class AccountDetails(RetrieveAPIView): serializer_class = AccountSerializer queryset = Account.objects.all() urls.py router = routers.DefaultRouter() urlpatterns = [ path('', include(router.urls)), path('account/<pk>', AccountDetails.as_view()), ] -
docker endpoint for "default" not found
i did clone a project and in first step when i tried to start container,i did run windows cmd in my project root and i type this command: docker-compose up --build and this massege showen to me: docker endpoint for "default" not found. i'll be more than happy if somebody help me. when i write this command for first time i hade an internet problem it got pause, in second time started to download something then this massege printed. i tried to delete my old Containers, and also i try with my VPN on and off, and restart docker in powershell. -
"proxy_pass" directive is duplicate
Getting the error: nginx: [emerg] "proxy_pass" directive is duplicate in /etc/nginx/sites-enabled/mhprints:12 nginx: configuration file /etc/nginx/nginx.conf test failed when trying to run my django project on nginx and gunicorn. my settings in folder error points to: server { listen 80; server_name 194.146.49.249; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/dave/mhprints; } location / { include proxy_params; proxy_pass http://unix:/run/gunicorn.sock; } } Can't find a fix, hoping somebody knows on here. -
Question for starting django web (beginner))
I have experienced problem in creating my own page on django. I follow the tutorial but get the different results. The error is page not found and Using the URLconf defined in djangonautic.urls, Django tried these URL patterns, in this order: admin/ about/ ^$ The empty path didn’t match any of these.It would be appreciate if someone can help me: urls.py from django.contrib import admin from django.urls import path from. import views urlpatterns = [ path(r'^admin/', admin.site.urls), path(r'^about/$', views.about), path(r'^$', views.homepage), path(r'^$', views.index), ] views.py from django.http import HttpResponse from django.shortcuts import render def about(request): return HttpResponse('my name is Jacky') def homepage(request): return HttpResponse('welcome home') def index(request): return HttpResponse("Hello, world I am the king") The web page will be display normally, no 404 is found -
"django.db.utils.OperationalError: no such function: lwgeom_version" Django Version 3.2.16, Spatialite Version 4.2.0 on Windows 10
I have a Django application that uses some geographic information. I have installed GDAL and installed Spatialite by downloading the windows binaries and placing them in my python directory (conda environment in my case) as detailed in this post. That was the only way I was able to get it to work without throwing an error. My database is set in settings.py as DATABASES = { 'default': { # 'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.contrib.gis.db.backends.spatialite', 'NAME': BASE_DIR / 'db.sqlite3', } } When I try to test a query based on geographic coordinates such as loc = Point(location['lng'], location['lat']) radius = D(mi=20) queryset = BusinessProfile.objects.filter(businessAddress__coordinates__dwithin=(loc, 2.0)) \ .filter(businessAddress__coordinates__distance_lte=(loc, radius)) \ .annotate(distance=Distance("businessAddress__coordinates", loc)) \ .order_by("distance") I get the following error: django.db.utils.OperationalError: no such function: lwgeom_version I have already installed GDAL and spatialite, can anyone help me figure out what the problem could be here? -
Send a audio recorded file from frontend to django view
Hi im trying to send a recorded audio to django backend. I used js to record the audio, How can i send it to django backend view (Maybe using POST method). Frontend: ` <button type="button" id="record">Record</button> <button type="button" id="stopRecord" disabled>Stop</button> </p> <p> <audio id=recordedAudio></audio> <script> navigator.mediaDevices.getUserMedia({audio:true}) .then(stream => {handlerFunction(stream)}) function handlerFunction(stream) { rec = new MediaRecorder(stream); rec.ondataavailable = e => { audioChunks.push(e.data); if (rec.state == "inactive"){ let blob = new Blob(audioChunks,{type:'audio/mp3'}); recordedAudio.src = URL.createObjectURL(blob); recordedAudio.controls=true; recordedAudio.autoplay=true; sendData(blob) } } } function sendData(data) {} record.onclick = e => { record.disabled = true; record.style.backgroundColor = "blue" stopRecord.disabled=false; audioChunks = []; rec.start(); } stopRecord.onclick = e => { record.disabled = false; stop.disabled=true; record.style.backgroundColor = "red" rec.stop(); } </script> ` How can I send this recorded audio to django view? Thank you. I want to get this recorded audio file into my django views.py. -
Forbidden Apache/2.4.41 (Ubuntu) Server at djangoexample.ru Port 80
does not work on remote hosting VDS django example on request in the console (env) root@vm2212126314:~/django_project# tail -f /var/log/apache2/error.log response [Wed Dec 14 23:07:46.528001 2022] [core:error] [pid 15644:tid 139855996606208] (13)Permission denied: [client 198.16.66.157:44077] AH00035: access to / denied (filesystem path '/root/django_project') because search permissions are missing on a component of the path [Wed Dec 14 23:07:48.259732 2022] [core:error] [pid 15644:tid 139856175347456] (13)Permission denied: [client 198.16.66.157:44077] AH00035: access to / denied (filesystem path '/root/django_project') because search permissions are missing on a component of the path [Wed Dec 14 23:07:50.125290 2022] [core:error] [pid 15644:tid 139856166954752] (13)Permission denied: [client 198.16.66.157:44077] AH00035: access to / denied (filesystem path '/root/django_project') because search permissions are missing on a component of the path [Wed Dec 14 23:11:51.679078 2022] [core:error] [pid 15645:tid 139856208918272] (13)Permission denied: [client 104.164.195.218:35699] AH00035: access to / denied (filesystem path '/root/django_project') because search permissions are missing on a component of the path how fix it <Directory /root/django_project> Options Indexes FollowSymLinks AllowOverride All Order allow,deny Allow from all Require all granted </Directory> ??? -
Django - Unable to write an interconected service layer
For several days I've been trying to implement a service layer in Django, to separate business logic from models and views. The way I do it is the following (as a example): from api.services.BoatService import BoatService class ApplicationService:boatService = BoatService() def find(self, application_id, user_id): #some business logic for search an object, raise custom exception, etc application = self.applicationService.find(args) In a different file: from api.services.ApplicationService import ApplicationService class BoatService: applicationService = ApplicationService() def find(self, boat_id, user_id): #some business logic for search an object, raise custom exception, etc boat = self.applicationService.find(args) The problem comes when I try to use methods from ApplicationService into BoatService, because I got the expected ImportError: cannot import name 'BoatService' from partially initialized module 'api.services.BoatService' (most likely due to a circular import). I need to implement dependency injection like Spring Boot (annotating with @service/@autowired) or anything that will allow me to use methods from both service interconnected (like another normal service in other framework) -
Type Validation in Django's JSONField
Problem Statement I have a Django model containing a JSONField among other fields: class MetaData(models.Model): main = models.ForeignKey() name = models.CharField() dict_field = models.JSONField() Where dict_field is a "data dump" for any remaining metadata that i don't want to include as a standalone field. Although it's a data "dump", I still want it to have basic type-validation. How can I validate the inputs of this JSONField such that it only accepts a pre-defined list of keys and their associated types, as follows: "key1": bool "key2": int "key3": Optional[int] Does django have functionality built in for this type of problem? If not, what other solutions can you recommend? (pydantic, etc.) -
sub domain pointed to the wrong website folder
I have a linux server that run multiple different website on multiple different domain which are working fine. But I created a sub domain for one of the domain which is demo.mywebsitedomain.com I did the configuration like it was a different domain which mean I created a specific nginx socket / service / nginx config file for this subdomain But when I go the my link demo.mywebsitedomain.com it run the website application of an other django application folder, it not the one who I have pointed in the socket and service file. I am verry confuse. It should run the django application whos in the testdemo folder but instead it run a different folder application. Those are the file I created for the subdomain sudo vim /etc/systemd/system/testdemo.socket [Unit] Description=gunicorn socket [Socket] ListenStream=/run/testdemo.sock Environment="PATH=/usr/bin:/home/tiber/testdemo/env/bin" [Install] WantedBy=sockets.target sudo vim /etc/systemd/system/testdemo.service [Unit] Description=gunicorn daemon Requires=testdemo.socket After=network.target [Service] User=tiber Group=www-data WorkingDirectory=/home/tiber/testdemo ExecStart=/home/tiber/testdemo/env/bin/gunicorn \ --access-logfile - \ --workers 3 \ --bind unix:/run/testdemo.sock \ mysite.wsgi:application [Install] WantedBy=multi-user.target sudo vim /etc/nginx/sites-available/testdemo server { listen 80; server_name demo.mywebsitedomain.com; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /var/www/testdemo; } location /media/ { root /var/www/testdemo; } location / { include proxy_params; proxy_pass http://unix:/run/testdemo.sock; } } -
Error in installing Django and running Django-admin
I'm encountering an issue while installing Django. The error after typing in 'django-admin' persists e even after adding the directory to PATH code adding directory to PATH I was trying to install django and expected to see a list of available subcommands on typing django-admin afterwards -
Django how can i style the checkboxes in CheckboxSelectMultiple as buttons
I have a project that i am working on and this is for the buy page. Chosen_services is a many to many field and this is my forms.py: class Meta: model = Order fields = ["chosen_services"] widgets = { 'chosen_services': forms.CheckboxSelectMultiple() } I want the checkboxes to be styled as btn btn-primary and the text on the button to be 'add' when the checkbox is not checked and i want it to be styled as btn btn-secondary and have the text 'remove' when the checkbox is checked. Unclicked Clicked I tried making a custom widget but i couldn't get it to work. I also tried to add attrs={'class': 'btn btn-primary'} but when i had this the parent element of the checkboxes got styled as a button and the checkboxes still remained checkboxes but where inside the button. I want to replace the checkbox not put it inside a button. -
Creating a simple multiple users app in django
So I've got three users, a teacher, student, and admin. Both teacher and student users work fine but when I try to login using the admin form, it redirects to the student login form. I think it's because there's something wrong with the urls.py and the way the next parameter is configured but I'm not quite sure where to proceed. Any help is much appreciated. Let me know if you need more information Here are my admin views.py @login_required @admin_required def profile(request): if request.method == 'POST': u_form = UserUpdateForm(request.POST, instance=request.user) p_form = ProfileUpdateForm(request.POST, request.FILES, instance=request.user.profile) if u_form.is_valid() and p_form.is_valid(): u_form.save() p_form.save() messages.success(request, f'Your account has been updated!') return redirect('profile') else: u_form = UserUpdateForm(instance=request.user) p_form = ProfileUpdateForm(instance=request.user.profile) context = { 'u_form': u_form, 'p_form': p_form } return render(request, 'users/profile.html', context) main urls.py urlpatterns = [ path('', classroom.home, name='home'), path('students/', include(([ path('', students.QuizListView.as_view(), name='quiz_list'), path('interests/', students.StudentInterestsView.as_view(), name='student_interests'), path('taken/', students.TakenQuizListView.as_view(), name='taken_quiz_list'), path('quiz/<int:pk>/', students.take_quiz, name='take_quiz'), ], 'classroom'), namespace='students')), path('teachers/', include(([ path('', teachers.QuizListView.as_view(), name='quiz_change_list'), path('quiz/add/', teachers.QuizCreateView.as_view(), name='quiz_add'), path('quiz/<int:pk>/', teachers.QuizUpdateView.as_view(), name='quiz_change'), path('quiz/<int:pk>/delete/', teachers.QuizDeleteView.as_view(), name='quiz_delete'), path('quiz/<int:pk>/results/', teachers.QuizResultsView.as_view(), name='quiz_results'), path('quiz/<int:pk>/question/add/', teachers.question_add, name='question_add'), path('quiz/<int:quiz_pk>/question/<int:question_pk>/', teachers.question_change, name='question_change'), path('quiz/<int:quiz_pk>/question/<int:question_pk>/delete/', teachers.QuestionDeleteView.as_view(), name='question_delete'), ], 'classroom'), namespace='teachers')), path('admins/', include(([ path('', admins.profile, name='profile'), ], 'classroom'), namespace='admins')), ] login urls.py urlpatterns = [ path('', include('classroom.urls')), path('accounts/', include('django.contrib.auth.urls')), … -
How to return an image as a response in Django
Doing a POST request to GPT-3 in order to get code completion output when I send some input. I seem to be getting the response I expect, but cannot actually get the code written by GPT-3. This is the response I get: ".\n\n## Challenge\n\nWrite a function called `preOrder` which takes a binary tree as its only input. Without utilizing any of the built-in methods available to your language, return an array of the values, ordered from left to right as they would be if the tree were represented by a pre-order traversal.\n\n## Approach & Efficiency\n\nI used a recursive approach to solve this problem. I created a function called `preOrder` that takes in a binary tree as its only input. I then created a variable called `output` that is an empty array. I then created a function called `_walk` that takes in a node as its only input. I then created a base case that checks if the node is null. If it is, it returns. If it is not, it pushes the value of the node into the `output` array. It then recursively calls the `_walk` function on the left and right nodes of the node. It then returns the … -
Ubuntu, Django, Gunicorn and Nginx
I've followed the digital ocean tutorial step by step in trying to get my project up and running using the packages in the title of this post. I keep getting an error returned and I cannot fix it. I've gone through the tutorial multiple times and still leads to same errors. Heres what I followed: Tutorial ERROR: nginx: [emerg] unknown directive "http://unix:/run/gunicorn.sock" in /etc/nginx/sites- enabled/mhprints:9 nginx: configuration file /etc/nginx/nginx.conf test failed SITES-ENABLED file server { listen 80; server_name mysite.com www.mysite.com; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { root /home/dave/mhprints; } location / { include proxy_params; http://unix:/run/gunicorn.sock; } } Any one have any idea? Thank you in advance for your time. -
How to get data for a given search query
I have a table for ManyToMany relationship. Where each Tutor need to input multiple days that he wants to tutor student. Like: Availability Tutor: user available_day time t1 Sun 6,7,8 t2 mon 3,4 t1 mon 1,2 I would like to get all tutor where availablity is based on search day. Model: class TutorProfile(models.Model): user = models.ForeignKey( settings.AUTH_USER_MODEL, on_delete=models.CASCADE) tutor_availablility = models.ManyToManyField( Day) queryset: def get_queryset(self): subject_param = self.request.GET.get('subject') bookday = self.request.GET.get('book_day') grade = self.request.GET.get('grade') li = list(bookday.split(",")) print("Book Info:", li) for i in range(len(li)): print(li[i]) _day_name = datetime.strptime(li[i], "%d-%m-%Y").strftime("%A") print("Day Name:", _day_name) day_num = Day.objects.get(day_name=_day_name) print("Day_Num",day_num) result = TutorProfile.objects.filter( tutor_availablility=day_num).all() return result When I run this query it only loop over one time for one day but not for multiple days. Now how may I run this query so that it will not stop after one loop. After One loop it says: An exception occurred An exception occurred I tried to apply try catch block here. But getting no clue. Why stop loop after one cycle? -
missing FROM-clause in posgressql
I'm facing the below error while executing the below SQL statement in Django after converting from sqlite to postgressql, it was working fine with sqlite. joined_data = HistoryTable.objects.raw( ''' SELECT pages_historytable.id, pages_historytable.dial, pages_historytable.request_status, pages_historytable.summary, pages_historytable.registration_date, dashboard_storesemails.emails, dashboard_storescode.agent_name FROM pages_historytable LEFT JOIN dashboard_storescode ON pages_historytable.dial = dashboard_storescode.dial LEFT JOIN dashboard_storesmails ON dashboard_storescode.shop_code = dashboard_storesmails.dtscode WHERE pages_historytable.request_status = 'Rejected' AND pages_historytable.Today_Date = %s; ''',[today]) The error is missing FROM-clause entry for table "dashboard_storesemails" LINE 2: ...le.summary, pages_historytable.registration_date, dashboard_... -
How to keep parameters next when going to another page Django
How can I keep this parameter next= from the url http://127.0.0.1:8000/login/?next=/checkout/ when i click on a href to access another page http://127.0.0.1:8000/register/ def login(request): .... .... auth.login(request, user) url = request.META.get('HTTP_REFERER') try: query = requests.utils.urlparse(url).query # next=/checkout/ params = dict(x.split('=') for x in query.split('&')) if 'next' in params: nextPage = params['next'] return redirect(nextPage) except: return redirect('home') This is on the login page, and I need that if this href is clicked it continues the parameters next=/checkout/ on the register page -
Django VSCode debugging going wrong
I'm studing some Django, mainly DRF, but some times what i do goes different of what my instructor does. Actually, i'm now facing a problem when I try to debug my code with the VSCode debugger, as he does in the classes, where, when he starts the application with the debugger, it starts normally, but when he makes a requests that passes by a certain view or serializer, the application stops at the breakpoint and wait his commands, like a normal debug. When I try the same, as the application starts, it first stops at the breakpoints, while Django is performing the system checks, and then does not stops when the request passes by the view, for example. The only step he made to configure the debugger was creating the launch.json file the VSCode recommends, here is an example of mine: { // Use o IntelliSense para saber mais sobre os atributos possíveis. // Focalizar para exibir as descrições dos atributos existentes. // Para obter mais informações, acesse: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Python: Django", "type": "python", "request": "launch", "stopOnEntry": false, "program": "${workspaceFolder}\\src\\manage.py", "args": [ "runserver", ], "django": true, "justMyCode": false } ], } with these settings, the …