skip to Main Content

PERFORMANCE Calling multiple times a posgres db to get filtered queries vs querying all objects and filtering in my django view – Postgresql

I'm working in a Django project and it has a postgreSQL db. I'm calling multiple times the model to filter the results: latest = Product.objects.all().order_by('-update_date')[:4] best_rate = Product.objects.all().order_by('rating')[:2] expensive = Product.objects.all().order_by('-price')[:3] But I wonder if it's better for performance and…

VIEW QUESTION

How to delete 200,000 records with DJango? – Postgresql

Situation: I have Model have a relation 1-1, sample: class User(models.Model): user_namme = models.CharField(max_length=40) type = models.CharField(max_length=255) created_at = models.DatetimeField() ... class Book(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) And I have a around 200,000 records. Languague: Python Framework: Django Database: Postgres…

VIEW QUESTION

Visual Studio Code – "No module named manage" error when trying to debug a Werkzeug Django app in VSCode

As the title says. I have a Django 4.1 app, which uses Werkzeug to enable https. I have the following launch.json set up: { "version": "0.2.0", "configurations": [ { "name": "Python: Django", "type": "python", "request": "launch", "python": "${workspaceFolder}/venv/Scripts/python.exe", "program": "${workspaceFolder}\appname\manage.py",…

VIEW QUESTION
Back To Top
Search