Questions tagged [django-postgresql]

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

207 questions
26
votes
1 answer

How to start Postgres server?

Ive actually had this problem for a while but I've finally decided to take it on. Postgres was initially installed using Brew. After my upgrade to OSX 10.8.2 to receive a psql: could not connect to server: No such file or directory Is the…
harristrader
  • 1,181
  • 2
  • 13
  • 20
21
votes
5 answers

ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value

I'm in the midst of setting up my Django project on Heroku. I have been following the documentation, but when I foreman start I receive an error that I can't quite figure out. I have set up my engine files, but it doesn't seem to want to work. Full…
ApathyBear
  • 9,057
  • 14
  • 56
  • 90
21
votes
3 answers

How to debug "could not receive data from client: Connection reset by peer"

I'm running a django-celery application on Ubuntu-12.04. When I run a celery task from my web interface, I get the following error, taken form postgresql-9.3 logfile (maximum level of log): 2013-11-12 13:57:01 GMT tss_usr 8113 LOG: could not…
caneta
  • 1,612
  • 2
  • 20
  • 34
15
votes
1 answer

Error Using CheckConstraint in Model.Meta along with Django GenericForeignKey - Joined field references are not permitted in this query

I am trying to restrict GFK to be pointed to objects of a few models only, and I thought CheckConstraint will be a great way to do this, however I get this error class ManualAdjustment(Model): content_type = models.ForeignKey(ContentType,…
15
votes
2 answers

Postgres: values query on json key with django

I need to do a values/values_list query on nested key on a postgres backed jsonfield in django 1.10 eg. class AbcModel(models.model): context = fields.JSONField() If it has values like: { 'lev1': { 'lev': 2 } } I want to run a queries…
Shaumux
  • 735
  • 11
  • 25
14
votes
1 answer

Exclude null values from Django's ArrayAgg

I'm using Django's postgres-specific ArrayAgg aggregator. It works fine but when the list is empty I get [None] instead of []. Is there any way to filter these null values out? I've tried to pass a filter argument to ArrayAgg but it didn't work.…
14
votes
3 answers

django id integer limit

Is there a limit to the AutoField in a Django model or the database back-ends? The Django project I am working on could potentially see a lot of objects in certain database tables which would be in excess of 40000 within a short amount of time. I am…
Taco Python
  • 141
  • 1
  • 3
13
votes
2 answers

Setup postgres in Github Actions for Django

I'm currently working on a website right now on Django. On my computer, I am running it on Docker with a postgres database. Here's the docker-compose file I have: version: '3' services: db: image: postgres environment: …
12
votes
1 answer

Cannot cast type integer to uuid

I tried to run python3 manage.py migrate, but i got this error: File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/django /db/backends/utils.py", line 84, in _execute return self.cursor.execute(sql,…
12
votes
4 answers

Specifying Readonly access for Django.db connection object

I have a series of integration-level tests that are being run as a management command in my Django project. These tests are verifying the integrity of a large amount of weather data ingested from external sources into my database. Because I have…
9
votes
2 answers

Should I use ArrayField or ManyToManyField for tags

I am trying to add tags to a model for a postgres db in django and I found two solutions: using foreign keys: class Post(models.Model): tags = models.ManyToManyField('tags') ... class Tag(models.Model): name =…
aliva
  • 5,450
  • 1
  • 33
  • 44
8
votes
2 answers

Stop Django translating times to UTC

Timezones are driving me crazy. Every time I think I've got it figured out, somebody changes the clocks and I get a dozen errors. I think I've finally got to the point where I'm storing the right value. My times are timestamp with time zone and I'm…
Oli
  • 235,628
  • 64
  • 220
  • 299
8
votes
2 answers

How to filter gte,lte date on datetime field?

I'm trying to figure out how to filter QuerySet using date extracted from datetime. I use Django-filter and I can't compose such lookup without iterating over QuerySet which is very uneffective. I tried datetime__date__gte which doesn't work. class…
Milano
  • 18,048
  • 37
  • 153
  • 353
8
votes
2 answers

order_by on Many-to-Many field results in duplicate entries in queryset

I am attempting to perform an order_by based a m2m field, but it ends up creating duplicate entries in my queryset. I have been searching through the django documentation and related questions on stack exchange, but I haven't been able to come up…
8
votes
2 answers

How big can Django primary keys get?

Is there a maximum value as to how high pk values for a model can get? For example, for something like an activity feed model, the pk's can get really large. Ex, "Kyle liked this post", "Alex commented on this post" etc..As you can see, for every…
deadlock
  • 7,048
  • 14
  • 67
  • 115
1
2 3
13 14