Questions tagged [django-postgresql]

Use this tag for PostgreSQL issues which are to be solved in accordance with Django coding best practices.

207 questions
0
votes
0 answers

Django 3.2 - django.db.utils.ProgrammingError: column "id" referenced in foreign key constraint does not exist

I am currently developping a django project, and I needed to move to PostgreSql databases. I did it just like this in my settings.py file: DATABASES = { 'default': { 'ENGINE' : 'django.db.backends.postgresql_psycopg2', 'NAME' …
0
votes
2 answers

I can't seem to find a way to write into heroku's postgres from my django app

I wrote an app with Django and it has been working fine when running locally. I know deployed it with Heroku and the app run as well. However, I when I python manage.py createsuperuser it says that I successfully created the superuser but nothing is…
giaggi
  • 542
  • 5
  • 16
0
votes
1 answer

docker-compose run: django and postgres "strange" behavior

When I run the following command: docker-compose run django python manage.py startapp hello OR docker-compose run django python manage.py createsuperuser Instead of starting a new container, it opens a Postgres shell. However, when I'm using…
0
votes
1 answer

Error when changing from Sqlite3 into Postgresql in Django, with annotation and pagination

I'm learning Django and used Sqlite3 for my site until today, I changed the database into Postgres. My site kind of mimics Facebook. I have a ListView that will list all posts. In get_queryset(), I annotate each post with some additional info, such…
0
votes
0 answers

Django Postgresql Search Not Showing Results

I'm making a Django website that has Full Text Search with Postgres. However, when I make my search, none of the results show up. Is there anything I did wrong? Here's my code: Views.py from django.shortcuts import render from…
0
votes
0 answers

How to create write and read replicas,for a Django app using PostgreSQL, using automatic database routing

In order to increase the concurrency of my Django app, I would like to create read replicas of my master database. I would like to know what is the best way of implementing this. It would be great if this can be implemented using Automatic database…
0
votes
1 answer

Django Array agregate on multiple fields

I am using postgres as my backedn in django Application I have 4 models in my app class sprint(models.model): sprintname = models.CharField(max_length=100) ..... class testcases(models.model): testcasename = models.CharField(max_length=100) sprint…
user3048099
  • 285
  • 1
  • 4
  • 10
0
votes
0 answers

django switch databse user on each subdomain in the same app

i want to make a django application and for a security reasons, i have three types of users (admins, teachers , and students) i want to make a subdomain for each type of users users.domain.com teachers.domain.com admins.domain.com after the…
0
votes
3 answers

Why I obtain this error migrationg data from SQL Lite to Posgres DB ? duplicate key value violates unique constraint

I am pretty new in Django and Python and I am trying to follow this videotutorial about how to migrate a Django application from SqlLite to Postgres database: https://www.youtube.com/watch?v=ZgRkGfoy2nE&t=554s But I am finding some problem.…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596
0
votes
1 answer

Column core_event.hometask does not exist

When I run my Django project on production server, I have this error: ProgrammingError at /admin/core/event/ column core_event.hometask does not exist LINE 1: ..._event"."is_approved", "core_event"."event_type", "core_even... What I should do to…
0
votes
1 answer

Why is CICharField not creating database column?

I am trying to use the Django CITextExtension PostgreSQL extension to create case-insensitive text fields in my database. Concretely, here is how I am trying to use django.contrib.postgres.fields.CICharField in my Expression model to create a…
0
votes
1 answer

Django - relation "app_name_modelname" does not exist

I've deployed my application to DigitalOcean. Everything works fine except this situation. I've added new GeneralComplaintDocument model, made migration locally, pulled from Github last version of project on DigitalOcean's server, deleted all…
0
votes
1 answer

Django helper function executed only in single test when PostgreSQL used

Recently I've changed db engine from SQLite to PostgreSQL. I have successfully migrated whole db design to PostgreSQL (just simple makemigaretions, migrate). Once I ran tests some have failed for some unknown reason (errors suggest that some objects…
sebap123
  • 2,541
  • 6
  • 45
  • 81
0
votes
0 answers

Django JSONField nested greater than operation

Here's the structure of the JSONField - data I have. data : { "animals" : [ "animal_id" : 2321, "legs" : [ { "name" : "front", "measured_at" : 1596740795.453353 }, { "name" : "back", …
Tchinmai
  • 620
  • 1
  • 6
  • 20
0
votes
0 answers

Django - size of ArrayField based on a field value of a related model

I have 2 models: Report and STO with a one-to-many relationship between them, so a STO can have many related reports. STO model class STO(TerminableWithTerminableRelatedModel): name = models.CharField(_('name'), unique=True, blank=False,…
dc_Bita98
  • 851
  • 2
  • 17
  • 35