Django community: RSS
This page, updated regularly, aggregates Django Q&A from the Django community.
-
In django I have created "tool" app, When I try to import tool to other file I got error "No module named 'tool' "
please check the following image for reference from tool.models import loginauth Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'tool' -
Redis giving the error: TypeError: Connection.__init__() got an unexpected keyword argument 'username'
I am integrating the celery in our project. Redis giving the error when, I am trying to run this command python -m celery -A claims_dashboard worker # Celery settings.py CELERY_BROKER_URL = "redis://0.0.0.0:6379" CELERY_RESULT_BACKEND = "redis://0.0.0.0:6379" CELERY_ACCEPT_CONTENT = ['application/json'] CELERY_RESULT_SERIALIZER = 'json' CELERY_TASK_SERIALIZER = 'json' # celery.py import os from celery import Celery os.environ.setdefault("DJANGO_SETTINGS_MODULE", "claims_dashboard.settings") app = Celery("claims_dashboard") app.config_from_object("django.conf:settings", namespace="CELERY") app.autodiscover_tasks() #init.py file from .celery import app as celery_app __all__ = ('celery_app',) This is the traceback of my code , I have not write anywhere the "username" in my code. (django-venv) naveenprakashsatyarthi@LAP-ART-MP283WK5:~/Desktop/Artivatic/claims_dashboard/claims_dashboard_backend/claims_dashboard$ python -m celery -A claims_dashboard worker -------------- celery@LAP-ART-MP283WK5 v5.1.1 (sun-harmonics) --- ***** ----- -- ******* ---- Linux-5.15.0-53-generic-x86_64-with-glibc2.35 2022-11-23 05:25:07 - *** --- * --- - ** ---------- [config] - ** ---------- .> app: claims_dashboard:0x7f233d74ba90 - ** ---------- .> transport: redis://0.0.0.0:6379// - ** ---------- .> results: redis://0.0.0.0:6379/ - *** --- * --- .> concurrency: 8 (prefork) -- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker) --- ***** ----- -------------- [queues] .> celery exchange=celery(direct) key=celery [2022-11-23 05:25:07,912: CRITICAL/MainProcess] Unrecoverable error: TypeError("Connection.__init__() got an unexpected keyword argument 'username'") Traceback (most recent call last): File "/home/naveenprakashsatyarthi/django-venv/lib/python3.10/site-packages/kombu/transport/virtual/base.py", line 925, in create_channel return self._avail_channels.pop() IndexError: pop from empty list … -
Can I add a non-editable field to the class based view UpdateView in Django
class EmployeeView(generic.edit.UpdateView): model = Employee fields = '__all__' template_name = 'wfp/employee.html' def get_object(self, queryset=None): return Employee.objects.get(uuid=self.kwargs.get("employee_uuid")) has everything I need except the UUID that is on the employee which is non-editable. I'd really like to include that in the HTTPResponse so I can use elsewhere a link to another page. (Employee have allocations of things) Ideas? Thanks -
Django admin extend user permissions template
I have setup a custom user model with BaseUserManager and AbstractBaseUser. All is working fine but I am missing the Django build in user permissions. How can I extend a custom template to include this? -
How do I set up my Django urlpatterns within my app (not project)
Let's say I've got the classic "School" app within my Django project. My school/models.py contains models for both student and course. All my project files live within a directory I named config. How do I write an include statement(s) within config/urls.py that references two separate endpoints within school/urls.py? And then what do I put in schools/urls.py? For example, if I were trying to define an endpoint just for students, in config/urls.py I would do something like this: from django.urls import path, include urlpatterns = [ ... path("students/", include("school.urls"), name="students"), ... ] And then in school/urls.py I would do something like this: from django.urls import path from peakbagger.views import StudentCreateView, StudentDetailView, StudentListView, StudentUpdateView, StudentDeleteView urlpatterns = [ # ... path("", StudentListView.as_view(), name="student-list"), path("add/", StudentCreateView.as_view(), name="student-add"), path("<int:pk>/", StudentDetailView.as_view(), name="student-detail"), path("<int:pk>/update/", StudentUpdateView.as_view(), name="student-update"), path("<int:pk>/delete/", StudentDeleteView.as_view(), name="student-delete"), ] But how do I do I add another urlpattern to config/urls.py along the lines of something like this? The include statement needs some additional info/parameters, no? from django.urls import path, include urlpatterns = [ ... path("students/", include("school.urls"), name="students"), path("courses/", include("school.urls"), name="courses"), ... ] And then what happens inside of school/urls.py? I'm open to suggestions, and definitely am a neophyte when it comes to the Django philosophy. … -
Adding foriegn key to model- Django
I am a novice in django. So please hear me out. I have 2 models: 1. class Plans(models.Model): id = models.IntegerField(primary_key=True) name = models.CharField(max_length=255) plan_type = models.CharField(max_length=255) class Order(models.Model): id = models.IntegerField(primary_key=True) selected_plan_id = models.IntegerField(primary_key=True) Order model's selected_plan_id is Plans id. Which model should i add foriegn key to? and how? So far i have started learning django, -
How can I make a view with an admin and user?
I'm making a crude in Django, and when I create it's shows and options depending if you are an administrator or a Jefe from the table. the administrator its from panel Django class UsuarioCrear(SuccessMessageMixin, CreateView): model = Usuarios form = Usuarios if user.is_superuser: fields = ['nombre', 'correo', 'contraseña', 'cedula'] success_message = 'usuario creado correctamente !' def get_success_url(self): return reverse('leer') else: fields = "_all_" success_message = 'usuario creado correctamente !' def get_success_url(self): return reverse('leer') So, I try with an if asking if is a superuser show al fields and if not is a super user show an specific fields, but i got an error when i do that -
How to update django database with a list of dictionary items?
I have a list of key value pairs here. stat = [{'id': 1, 'status': 'Not Fixed'}, {'id': 2, 'status': 'Not Fixed'}, {'id': 4, 'status': 'Not Fixed'}, {'id': 5, 'status': 'Not Fixed'}, {'id': 6, 'status': 'Not Fixed'}, {'id': 7, 'status': 'Not Fixed'}] The id in this list represents the id(primary key) of my django model. How can I update the existing records in my database with this list? Models.py file class bug(models.Model): ....... ....... status = models.CharField(max_length=25, choices=status_choice, default="Pending") -
How to allow changing a model field if the user has a certain role?
I have CustomUserModel in Django and four roles - user, student, curator, admin And I have group field in CustomUserModel, which default value is Null Now every User can have group, but I want only students to have it. How can I do this on my model level? (like how to check that you need to have Student role to change the value of the group field from Null to other) I tried to use validator, but there I can get only the value of group, and can't use self to check like if self.role = STUDENT USER = 'user' STUDENT = 'student' CURATOR = 'curator' ADMIN = 'admin' ROLES = ( (USER, USER), (STUDENT, STUDENT), (CURATOR, CURATOR), (ADMIN, ADMIN), ) def validate_user_can_have_group(value): ### class User(AbstractUser): role = models.CharField(max_length=max([len(role[0]) for role in ROLES]), choices=ROLES, default=USER,) group = models.ForeignKey('structure.Group', on_delete=models.SET_NULL, validators=[validate_user_can_have_group], related_name='users', blank=True, null=True,) class Meta: swappable = "AUTH_USER_MODEL" ordering = ['username'] @property def is_admin(self): return ( self.role == ADMIN or self.is_staff or self.is_superuser ) @property def is_curator(self): return self.role == CURATOR @property def is_student(self): return self.role == STUDENT @property def is_user(self): return self.role == USER def __str__(self): return self.username -
How to store user input in a variable in django python
So i want to take the user input and compare it to data present in the sqlite3 db, and if matches I'd like to print that whole row, using django orm. form.html <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title> Assignment 3</title> </head> <body> <h1> Please enter the product barcode in the text box below: </h1> <form action="search"> BARCODE: <input type="text" name="barcode"> <br> <br> <input type="submit"> </form> </body> </html> urls.py from django.urls import path from . import views urlpatterns = [ path('', views.index, name='index'), path('search', views.search, name='search'), ] views.py from django.shortcuts import render from django.http import HttpResponse # Create your views here. def index(request): return render(request, 'form.html') def search(request): return render(request, 'result.html') I really appreciate your time and help, thank you! i think adding logic to the search function to compare should work but extremely new to django and dont really know on how to start.. -
How to sent an extra field to serializer from view in django rest framework?
serializer.py class DataSerializer(serializers.ModelSerializer): flag = serializers.BooleanField(required=False) class Meta: model = Plans fields = { 'id', 'name', 'type', 'details', 'price' } views.py class DetailsView(APIView): def get(self, request): user_sub_plans = Order.objects.filter(id=request.user).first() selected_plan = False if user_plans is not None: selected_plan = True original_plans = Plans.objects.all() user_serializer = DataSerializer(original_plans, many=True) return Response(user_serializer.data) These are my serializers and views. I want to send selected_plan into my serializers as an output. I have created an extra field in serializers called flag for this but don't know how to send it. Can anyone help? -
Error de Python 4.0.1 con conexión a SQL Server
He intentado conectar a SQL server con Python Django pero no me permite realizar la migración inicial pero me sale error. enter image description here Me sale que Django no tiene soporte. Estos son los paquetes que he usado: Package Version asgiref 3.5.2 asttokens 2.1.0 backcall 0.2.0 colorama 0.4.6 contourpy 1.0.6 cycler 0.11.0 debugpy 1.6.3 decorator 5.1.1 Django 4.0.8 django-environ 0.9.0 django-pyodbc 1.1.3 django-pyodbc-azure 2.1.0.0 djangorestframework 3.14.0 djangorestframework-simplejwt 5.2.2 entrypoints 0.4 executing 1.2.0 fonttools 4.38.0 ipykernel 6.17.1 ipython 8.6.0 jedi 0.18.1 jupyter_client 7.4.7 stack-data 0.6.1 tornado 6.2 traitlets 5.5.0 tzdata 2022.6 wcwidth 0.2.5 Espero que el aplicativo Django pueda conectarse con una Base de datos SQL Server Express local -
Exposing websockets port through same location dokku
I have a django project where I run my web and django channels as separate procs in the Procfile: web: gunicorn django_project.wsgi:application socket: daphne django_project.asgi:application And have exposed ws/wss using dokku proxy:ports-add web ws:80:8000 wss:443:8000 (web is my dokku app name): =====> web proxy information Proxy enabled: true Proxy port map: http:80:5000 https:443:5000 ws:80:8000 wss:443:8000 Proxy type: nginx I've exposed container port 8000 because daphne runs on port 8000 by default: app[socket.1]: Starting server at tcp:port=8000:interface=127.0.0.1 app[socket.1]: Configuring endpoint tcp:port=8000:interface=127.0.0.1 app[socket.1]: Listening on TCP address 127.0.0.1:8000 But I'm unable to connect to my websocket in the browser. I get a Not Found: /ws/mywebsocket error for my websocket endpoint, and socket.onclose function immediately gets called with a code: 1006. I think I need to create a custom nginx.sigil for dokku to redirect to the websocket if the url contains /ws/, but a lot of the answers seem out of date and not working. -
Add field to DRF's exceptions.PermissionDenied
Right now django-rest-framework's exceptions.PermissionDenied returns a 403 and a detail saying "You don't have permission to perform his action." {"detail": "You don't have permission to perform this action."} I'd like to extend this to include a "reason" field, so I can do something like `MyException(detail="Some detail here", reason="INSUFFICIENT_TIER"). but detail seems to chain quite far up and get transformed in quite a few places. Does anyone know how I might easily add a field that will be returned in the json above? Here's DRF's exception for reference. class PermissionDenied(APIException): status_code = status.HTTP_403_FORBIDDEN default_detail = _('You do not have permission to perform this action.') default_code = 'permission_denied' It extends APIException: class APIException(Exception): """ Base class for REST framework exceptions. Subclasses should provide `.status_code` and `.default_detail` properties. """ status_code = status.HTTP_500_INTERNAL_SERVER_ERROR default_detail = _('A server error occurred.') default_code = 'error' def __init__(self, detail=None, code=None): if detail is None: detail = self.default_detail if code is None: code = self.default_code self.detail = _get_error_details(detail, code) def __str__(self): return str(self.detail) def get_codes(self): """ Return only the code part of the error details. Eg. {"name": ["required"]} """ return _get_codes(self.detail) def get_full_details(self): """ Return both the message & code parts of the error details. Eg. {"name": [{"message": "This … -
Python: Populate word template from database through checkbox
I have a list which can be downloaded through checkbox with the same project number only. Here's my code. I tried forloop, but it changed my template style. So if I use this (x,y) method to populate my table, I don't know how to write my views.py. Hope you can help me, I'm so new to this. list.html {% for obj in queryset %} <tr> <td><input type="checkbox" name="sid" value="{{obj.id}}"></td> <td>{{ obj.project_number.project_number }}</td> <td>{{ obj.project_number.project_name}}</td> <td>{{ obj.sample_name }}</td> <td>{{ obj.sample_type}}</td> <td>{{ obj.hardware_version }}</td> <td>{{ obj.software_version}}</td> <td>{{ obj.config_status }}</td> <td>{{ obj.number}}</td> <td>{{ obj.sample_number}}</td> </tr> {% endfor %} models.py class Sample(models.Model): project_number = models.ForeignKey("Project", on_delete=models.CASCADE) sample_name = models.CharField(max_length=32) sample_type = models.CharField(max_length=32) hardware_version = models.CharField(max_length=32) software_version = models.CharField(max_length=32) config_status = models.CharField(max_length=18) number = models.IntegerField(default=0) sample_number = models.CharField(max_length=17) views.py def save(request): sid = request.POST.getlist('sid') #checkbox samples = Sample.objects.all()[0:14] project = Project.objects.get(id=samples.project_id) samples.project = project template = DocxTemplate("sample.docx") ..... template.save('sample1.docx') return redirect('/list/') Here's the look of my template -
Webpack Proxy does not work with django backend
I recently had to add webpack to my react app. When i try to fetch from my django backend on http://localhost:9000 i get a "AxiosError Request failed with status code 404". The request does not get to my backend even with the proxy set. devserver settings headers: { "Access-Control-Allow-Origin": "*", }, proxy: { "/api": { target: "http://localhost:9000", pathRewrite: { "^/api": "" }, secure: false, changeOrigin: true, }, }, Am i missing anything ? I already had the react frontend requesting from my django server before adding webpack. -
How to access value in QuerySet Django
I am creating a simple Pizza Delivery website and trying to add an option to choose a topping. When I want to print Ingredients it returns QuerySet and Values in it separated by a comma. Is there any option how can I get values based on their variable names (ex. ingredients.all[0].toppingName -> cheese) or is there any methods which allows to get values separately. Of course, kludge with .split works but it is awful -
How to load images in django reportlab
hi i am trying to load a image onto a pdf with reportlab but i keep getting OSError at /view_checklist_print/1 Cannot open resource "check_box_outline_blank.svg" This is my test i21 = False This is my view def checklist_report(reques): buffer = io.BytesIO() c = canvas.Canvas(buffer, pagesize=(8.5 * inch, 11 * inch)) def checkboxgenerator(a, b, checkdata): checked = 'check_box_FILL.svg' unchecked = 'check_box_outline_blank.svg' x_start = a y_start = b blankbox = c.drawImage(unchecked, x_start, y_start, width=120, preserveAspectRatio=True, mask='auto') checkedbox = c.drawImage(checked, x_start, y_start, width=120, preserveAspectRatio=True, mask='auto') if checkdata == False: return blankbox else: return checkedbox checkboxgenerator(20, 300, i21) c.showPage() c.save() buffer.seek(0) return FileResponse(buffer, as_attachment=False, filename=test.pdf') Please can you help me load the image correctly -
Apple SSO breaks after Django 4 upgrade
After upgrading from django 3 to django 4, the "Sign in with Apple" feature started breaking with the following error Your request could not be completed because of an error. Please try again later. The javascript, the frontend html, and the Apple ID url are all identical, and there is no useful error in the console. What is going on? -
Disable a charfield in DJANGO when I'm creating a new User
I'm trying to do a crud in Django, it's about jefe and encargados. When I am logged in as an administrator, it has to allow me to create a encargados, but not a manager, but if I log in as a manager, it has to allow me to create a new encargados. For the jefe I am using a table called users and for the admin I am using the one from the Django admin panel. Here are the models: roles = ( ('encargado', 'ENCARGADO'), ('jefe','JEFE'), ) class Usuarios(models.Model): id = models.BigAutoField(primary_key=True) nombre = models.CharField(max_length=30) rol = models.CharField(max_length=30, choices=roles, default='encargado') correo = models.CharField(max_length=30) contraseña = models.CharField(max_length=30) cedula = models.CharField(max_length=30) class Meta: db_table = 'usuarios' This is the create view class UsuarioCrear(SuccessMessageMixin, CreateView): model = Usuarios form = Usuarios fields = "__all__" success_message = 'usuario creado correctamente !' def get_success_url(self): return reverse('leer') This would be the html to create, here I put a restriction that the roles are only seen as administrator. but really what is necessary is that if I am as an administrator it only lets me select the jefe and if I am as a jefe it only lets me select encargados {% csrf_token %} <!-- {{ form.as_p … -
Django with bootstrap DateTimePicker: inputElement.dataset is undefined
When I try to add options to dateTimePicker it stops working. Website raise "Something went wrong! Check browser console for errors. This message is only visible when DEBUG=True", and when I enter the console on the browser I see this: Uncaught TypeError: inputElement.dataset is undefined and the error picks up from https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css in the datapicker-widget.js file class Topic(models.Model): speaker = models.ForeignKey(Profile, on_delete=models.SET(GUEST_ID)) seminar = models.ForeignKey(Seminar, on_delete=models.CASCADE) title = models.CharField(max_length=200) description = models.TextField(default='') speaker_name = models.CharField(max_length=200, default='') date = models.DateTimeField(null=True, blank=True) def __str__(self): return self.title class TopicCreateView(LoginRequiredMixin, CreateView): model = Topic form_class = TopicPageForm template_name = 'seminar/topic_form.html' def get_initial(self, *args, **kwargs): initial = super(TopicCreateView, self).get_initial(**kwargs) initial = initial.copy() initial['speaker'] = self.request.user.profile initial['speaker_name'] = self.request.user initial['date'] = datetime.datetime.now() return initial ... ` {% extends "seminar/base.html" %} {% load django_bootstrap5 %} {% load crispy_forms_tags %} {% block head_content %} {% endblock %} {% block content %} <div class="content-section"> <form method="POST"> {% csrf_token %} <fieldset class="form-group"> <legend class="border-bottom mb-4">Topic</legend> {{ form|crispy }} </fieldset> <div class="form-group"> <button class="btn btn-outline-info" type="submit">Save</button> </div> </form> </div> {% endblock content %} head <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous"> <link rel="stylesheet" type='text/css' href="{% static 'users/style.css' %}"> <link rel="stylesheet" type='text/css' href="{% static 'seminar/main.css' %}"> bottom body <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js" … -
Trying to run a container on docker but can not access the website of the application we created
We've been using python3 and Docker as our framework. Our main issue is that while we try to run the docker container it redirects us to the browser but the website can not be reached. But it is working when we run the commands python manage.py runserver manualy from the terminal of VS code here is the docker-compose.yml file ''' version: "2.12.2" services: web: tty: true build: dockerfile: Dockerfile context: . command: bash -c "cd happy_traveller && python manage.py runserver 0.0.0.0:8000 " ports: \- 8000:8000 restart: always the docker file FROM python:3.10 EXPOSE 8000 WORKDIR / COPY happy_traveller . COPY requirements.txt . RUN pip install -r requirements.txt COPY . . and the app structure |_App_Folder |_happy_traveller |_API |_paycache |_core |_settings |_templates |_folder |_folder |_folder |_manage.py |_dockerfile |_docker-compose.yml |_requirements.txt |_readmme.md |_get-pip.py We would really apreciate the help. thank you for your time -
Reverse for 'detalle_reserva' with arguments '('',)' not found. 1 pattern(s) tried: ['reserva/(?P<reserva_id>[^/]+)/\\Z']
Please help me, I don't know why I get this error, I'm following a youtube tutorial and I don't understand why the error. i try changing the path in urls but it didn't work. I was looking for more solutions to the same problem and none of them work. models.py from django.db import models from django.contrib.auth.models import User # Create your models here. class Reserva(models.Model): auto = models.CharField(max_length=100) fecha = models.DateTimeField(auto_now_add=True) fecha_reserva = models.DateField(null=True) hora1 = '9:00am - 10:00am' hora2 = '10:00am - 11:00am' hora3 = '11:00am - 12:00pm' hora4 = '12:00pm - 13:00pm' hora5 = '14:00pm - 15:00pm' hora6 = '15:00pm - 16:00pm' hora7 = '16:00pm - 17:00pm' hora8 = '17:00pm - 18:00pm' hora_reserva_CHOICES = [ (hora1, '9:00am - 10:00am'), (hora2, '10:00am - 11:00am'), (hora3, '11:00am - 12:00pm'), (hora4, '12:00pm - 13:00pm'), (hora5, '14:00pm - 15:00pm'), (hora6, '15:00pm - 16:00pm'), (hora7, '16:00pm - 17:00pm'), (hora8, '17:00pm - 18:00pm') ] hora_reserva = models.CharField( max_length=17, choices=hora_reserva_CHOICES, default=hora1 ) Mantención = 'Mantención' Reparación = 'Reparación' Limpieza = 'Limpieza' Servicios_CHOICES = [ (Mantención, 'Mantención'), (Reparación, 'Reparación'), (Limpieza, 'Limpieza'), ] Servicios = models.CharField( max_length=10, choices=Servicios_CHOICES, default=Limpieza, ) User = models.ForeignKey(User, on_delete=models.CASCADE) def __str__(self): return self.auto + ' -by ' + self.User.username url.py from django.contrib … -
How to install setuptools for python based project (ModuleNotFoundError: No module named 'setuptools')?
I 've a running Django project created with poetry I 'm trying to install its dependencies using poetry install using python 3.9` I 'm getting this error while installing cwd: C:\Users\Lenovo\AppData\Local\Temp\pip-req-build-1hvchk7d\ Complete output (3 lines): Traceback (most recent call last): File "<string>", line 1, in <module> ModuleNotFoundError: No module named 'setuptools' ---------------------------------------- WARNING: Discarding file:///C:/Users/Lenovo/AppData/Local/pypoetry/Cache/artifacts/0c/05/66/5aa05d2bdbafe6e3783cd138cb601eb252fdcfc29ba618431cd24deeaa/drf-access-policy-1.3.0.tar.gz. Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. WARNING: You are using pip version 21.1.2; however, version 22.3.1 is available. You should consider upgrading via the 'C:\Users\Lenovo\AppData\Local\pypoetry\Cache\virtualenvs\vending-machine-api-l-EiZrwy-py3.9\Scripts\python.exe -m pip install --upgrade pip' command. at ~\.poetry\lib\poetry\utils\env.py:1101 in _run 1097│ output = subprocess.check_output( 1098│ cmd, stderr=subprocess.STDOUT, **kwargs 1099│ ) 1100│ except CalledProcessError as e: → 1101│ raise EnvCommandError(e, input=input_) 1102│ 1103│ return decode(output) 1104│ 1105│ def execute(self, bin, *args, **kwargs): I 've tried these solution but none worked for me : pip install --upgrade pip pip install --upgrade wheel pip install setuptools -
Django App on Heroku: Trouble Connecting to Postgres Database After Upgrade
I'm having trouble connecting (?) to a Heroku Postgres mini database after upgrading from a free Heroku Postgres database. I have a Django app using hobby Heroku dynos. With Heroku's free services coming to an end, I tried to upgrade from the free Heroku Postgres service to the mini plan. I followed the steps for the pg:copy method. Something went wrong when I tried to deprovision the primary database. The release log on my Heroku Dashboard provides this error message: Traceback (most recent call last): File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/base.py", line 219, in ensure_connection self.connect() File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner return func(*args, **kwargs) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/base/base.py", line 200, in connect self.connection = self.get_new_connection(conn_params) File "/app/.heroku/python/lib/python3.9/site-packages/django/utils/asyncio.py", line 26, in inner return func(*args, **kwargs) File "/app/.heroku/python/lib/python3.9/site-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection connection = Database.connect(**conn_params) File "/app/.heroku/python/lib/python3.9/site-packages/psycopg2/__init__.py", line 127, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket? The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/app/manage.py", line 22, in <module> main() File "/app/manage.py", line 18, in main execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python3.9/site-packages/django/core/management/__init__.py", line 419, in execute_from_command_line utility.execute() …