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
2
votes
1 answer

How to use temporary storage for objects in Django?

I have a crawler in Django project which crawls thousands of urls. Crawling is performed every two hours. There are multiple requests per second which can slower the database. This is a parse method from spider: def parse(self, response): …
Milano
  • 18,048
  • 37
  • 153
  • 353
2
votes
1 answer

Alternative for django.db.close_connection()

Is there a possible way to re-establish MySQL connection in Django after it goes down? I am getting the following error while trying to access MySQL using the get_wsgi_application in django.core.wsgi: (2006,'MYSQL server has gone away')
Hemant
  • 225
  • 4
  • 17
2
votes
1 answer

How to convert custom id field to normal integer field?

I am desperately trying to get along with Django migrations, please help! This is what I have: class ReceiptNumber(models.Model): id = models.AutoField(primary_key=True, unique=True) This is what I need: class ReceiptNumber(models.Model): …
2
votes
2 answers

How to intelligently merge Django databases?

I have a Django project with 5 different PostgreSQL databases. The project was preemptively separated in terms of model routing, but has proven quite problematic so now I'm trying to reverse it. Unfortunately, there's some overlap of empty,…
2
votes
1 answer

Multiple Database in Django

I am trying to create a Q/A website using Django and I want to use mutiple databases for all the apps Two secure database like admin, auth, forum A less secure (like sqlite3) database for the rest But I don't want to re-configure my models and…
Jøê Grèéñ
  • 551
  • 1
  • 6
  • 15
2
votes
1 answer

Is it safe to delete the `django_session` table if my Django app is using a cache-based session backend?

I've enabled cached-based sessions, and it looks like the application is no longer using the django_session database table. Is it safe to delete it? Or will the next migrate just recreate it? Should I should just leave it in place, even if it's…
tino
  • 4,780
  • 5
  • 24
  • 30
2
votes
1 answer

Django : Is it better to set PostgreSQL as database from the start of project?

I just wonder whether I start with PostgreSQL or sqlite3 when starting Django project. I usually start with sqlite3, which is a default database, and change it into PostgreSQL at the time to deploy. I use TDD and heard that it is much faster when…
user3595632
  • 5,380
  • 10
  • 55
  • 111
2
votes
1 answer

Django error relation "auth_user" does not exist using multiple database

I'm working on Django 1.9 and python 3.3 project using multiple databases (different schema in a same postgresql database). When I try to migrate the project for the first time, I'm getting this error Running migrations: Rendering model states...…
2
votes
1 answer

django.db.utils.ProgrammingError: relation "django_session" does not exist line 1

I am using Django 1.8 python 3.5 and recently completed one app which was using sqlite and everything was fine now i created a new app that i need to connect to a existing database on postgre ( in the same project folder ) i did the database…
user1778743
  • 333
  • 2
  • 7
  • 19
2
votes
3 answers

Add more fields in the model and get the error "column ... does not exist"

I have a model like this : class Profile(models.Model): user = models.OneToOneField(User, on_delete=models.CASCADE) address = models.CharField(max_length=100) city= models.CharField(max_length=100) , after a while, I add 2 more fields…
Huy Than
  • 1,538
  • 2
  • 16
  • 31
2
votes
1 answer

Django Admin not saving data to the Database

I am trying to save data from my Django Admin to my database but somehow it is not happening. I have created a form in one of my apps which my admin uses.I am new to Django and any help would be greatly appreciated. Below is the relevant…
karan nayak
  • 23
  • 1
  • 4
2
votes
1 answer

Django: Can I build a model upon local files instead of a real database?

I'll provide more background information first. The question is asked again in the last bullet of "My Thoughts & Questions" section. Background I am working on a legacy system which looks kind of like a batch processing system: A job is passed…
yaobin
  • 2,436
  • 5
  • 33
  • 54
2
votes
1 answer

Am I right that TestCase clears DB in case of SQLite and doesn't clear it in case of PostgreSQL

The code is below. Two tests. The difference in settings: PostgreSQL and SQLite. Being switched to SQLite, these tests pass. But in case of PostgreSQL this error occurs: AssertionError: '/documents/1002/' != '/documents/1/' - /documents/1002/ ? …
Michael
  • 4,273
  • 3
  • 40
  • 69
2
votes
1 answer

Django CONN_MAX_AGE not working on Azure MSSQL DB

I am trying to use the next settings: DATABASES = { 'default': { 'ENGINE': 'sql_server.pyodbc', 'NAME': 'name', 'USER': 'user', 'PASSWORD': 'pw', 'HOST': 'host', 'PORT': '1433', …
Kristian
  • 738
  • 6
  • 15
2
votes
1 answer

Check for atomic context

One of my methods doesn't work when run on atomic context. I want to ask Django if it's running a transaction. The method can create a thread or a process and saves the result to database. This is a bit odd but there is a huge performance benefit…
Lindlof
  • 2,152
  • 2
  • 17
  • 26