Questions tagged [django-database]

django-database refers to database backends that Django supports out of the box

refers to database backends that Django supports out of the box.

This tutorial help you to make application using mongodb database. enter link description here

664 questions
3
votes
2 answers

django.db.utils.OperationalError: FATAL: database does not exist (postgres / deploy to digitalocean)

I am trying to deploy a project with digital ocean. I followed the instructions found at https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 Some of the important ones: I…
Justin
  • 1,329
  • 3
  • 16
  • 25
3
votes
1 answer

Django bulk update with data two tables over

I want to bulk update a table with data two tables over. A solution has been given for the simpler case mentioned in the documentation of: Entry.objects.update(headline=F('blog__name')) For that solution,…
AlanSE
  • 2,597
  • 2
  • 29
  • 22
3
votes
1 answer

Routing and middleware for multiple databases in Django

I have a problem correctly setting my middleware and routers to support multiple databases, one for each language (I decided to keep them separate). I tried to use this solution, but for now I didn't get much use of it. In my settings.py databases…
Pavel Shlepnev
  • 155
  • 1
  • 16
3
votes
1 answer

Django database cache TIMEOUT - make backend delete row

I'm not sure what Django database cache does with expired entries but it seems that they remain in the database. I want Django to delete them after they expire because their size is huge and there can be unlimited number of different keys. CACHES…
Milano
  • 18,048
  • 37
  • 153
  • 353
3
votes
0 answers

Using different databases depending on a parameter in the URL

Is there a way I can tell Django2 to use a different database (and cache/session store) depending on a parameter in the URL? Note that I have read the docs related to multiple databases en Django…
alexandernst
  • 14,352
  • 22
  • 97
  • 197
3
votes
1 answer

Connect to Django test database

Is there a way to connect to django test database using connections? I have tried cursor = connections['test_name_of_main_db'].cursor() and also specified the test db name in settings but I still receive errors: Traceback (most recent call…
Beliaf
  • 577
  • 2
  • 8
  • 25
3
votes
0 answers

Django refresh data from DB inside an atomic block

I have a complex block of code that handle the creation/update of ORM object relationships. Let's say the models are A and B and the association is a OneToOne A - B (A.b_line points to B). 1) Before creating/updating the associations some A objects…
Leonardo
  • 4,046
  • 5
  • 44
  • 85
3
votes
1 answer

Django modeltranslation - can't get and see original fields

I'm trying to use django-modeltranslation in my project. For now, just for Tag model with one field - name. I've created and registered TranslationOptions, then makemigrations and migrate. Now I can't access the original name text. It seems to be…
Milano
  • 18,048
  • 37
  • 153
  • 353
3
votes
1 answer

Django prevent migrations on remote database

I have a Django app that connects to two databases. One of my DBs is on a different (production) server. I want to make very sure that in developing my app, I don't accidentally migrate models on the production server. My understanding is this:…
Marc
  • 3,386
  • 8
  • 44
  • 68
3
votes
1 answer

django with multiple databases and foreignkeys for User

Suppose I have a django app on my server, but I wish to do authentication using django.contrib.auth.models where the User and Group models/data are on another server in another database. In Django, my DATABASES setting would be something like…
Marc
  • 3,386
  • 8
  • 44
  • 68
3
votes
1 answer

How to restore Django project with pg_dump file?

What is the procedure to restore a Django project using an already restored database from a PostgreSQL pg_dump. All django source code also exist. Will Django migration safe?
cw12345
  • 383
  • 1
  • 2
  • 9
3
votes
3 answers

Django postgress - multiple primary keys are not allowed error

I am running migrations on my production system which uses a Postgress database and when I run it I get this error: django.db.utils.ProgrammingError: multiple primary keys for table "website_experience" are not allowed But works well on my…
Francis N
  • 137
  • 1
  • 11
3
votes
1 answer

Django - Rollback is not happening when exception raised

settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'diva', 'USER': 'root', 'PASSWORD': 'admin', 'ATOMIC_REQUESTS':True, 'HOST': 'localhost', 'PORT': '3306', }, } views.py def…
3
votes
1 answer

Django __in lowercase

I'm using django-taggit, which handles the attachment of tags to arbitrary content types. I imported a large tag list, which contains many uppercase words, as well as lowercase words. Now, I' trying to get objects of another class containing a set…
schneck
  • 10,556
  • 11
  • 49
  • 74
3
votes
1 answer

Django database backend documentation

I want to adapt an existing db backend to a custom db engine that we are using. Is there any document or whitepaper that explains the design of django database backends? I've been searching through djangoproject and checked this question how to…
tato
  • 5,439
  • 4
  • 31
  • 27