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
0 answers

How to access Postgres through a SOCKS proxy in Django

I'd like to proxy database connections from Django through a SOCKS proxy. How can this be configured in Django?
Octodone
  • 515
  • 6
  • 13
2
votes
2 answers

Django: safely deleting an unused table from database

In my django application, I used to authenticate users exploiting base django rest framework authentication token. Now I've switched to Json Web Token, but browsing my psql database, I've noticed the table authtoken_token, which was used to store…
2
votes
2 answers

Pandas dataframe to Object instances array efficiency for bulk DB insert

I have a Pandas dataframe in the form of: Time Temperature Voltage Current 0.0 7.8 14 56 0.1 7.9 12 58 0.2 7.6 15 55 ... So on for a few hundred thousand rows... I need…
Mormoran
  • 751
  • 13
  • 34
2
votes
2 answers

Table 'django_migrations' already exists after dropping database

I recently had a database issue so I decided to nuke it since I had no important data. I deleted my migrations folder in my app directory and dropped the database. However now when I go to recreate everything with manage.py migrate I get the…
CalMac
  • 449
  • 1
  • 4
  • 30
2
votes
0 answers

Django Renaming/Refactoring a Custom User Model

I have a custom user model: class CustomUser(AbstractUser): already migrated and populated with some records. I want to rename this CustomUser to MyUserModel. In Pycharm I right-clicked on the name and chose refactor - rename so every reference to…
bcsta
  • 1,963
  • 3
  • 22
  • 61
2
votes
1 answer

django pyodbc Data Source Name not found

When Attempting to connect to my database server and database in Django, I am getting the error (django.db.utils.InterfaceError: ('IM002', '[IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0)…
wmoskal
  • 295
  • 1
  • 4
  • 15
2
votes
0 answers

Difference between my droplet's postgres database and a newly created managed database

What's the difference between my droplet's postgres database and a newly created managed database? I currently have a running web app that I made via django that's hosted on digital-ocean cloud service. My project involves sending of temperature…
Abraham
  • 111
  • 1
  • 4
2
votes
1 answer

Alloting a read replica to a particular app in Django?

The django project has multiple apps and they all right now access the same DB. If I want one app which has only read queries to read from read replica will I have to add routers for both DB or creating one router for read replica and alloting it to…
Sarwar
  • 415
  • 4
  • 10
2
votes
1 answer

Django intermediate table with a many-to-many field instead foreign key?

I have 2 models in my application: User Tower My goal is to associate many towers to a user using an intermediate table because I need to add a period of time. So I have something like this in my models: class Tower(models.Model): name =…
2
votes
2 answers

How does Django maintain consistency between its logical constraints, and its database?

Lets say I have a model defined as follows: class Foo(models.Model): bar = models.CharField(max_length=10) Using this model, I create a Foo object in my database using the following code: Foo.objects.create(bar="0123456789") Should work well…
darkhorse
  • 8,192
  • 21
  • 72
  • 148
2
votes
2 answers

Duplicate request threads create duplicate database entries in Django model

The problem: a signal receiver checks to see if a model entry exists for certain conditions, and if not, it creates a new entry. In some rare circumstances, the entry is being duplicated. Within the receiver function: try: my_instance =…
2
votes
1 answer

how to correctly assign the through attribute in django?

I was just looking the documentation to be able to change the intermediate table but when I implement it, I get into trouble: https://docs.djangoproject.com/en/2.0/topics/db/models/#extra-fields-on-many-to-many-relationships The problem as such is…
2
votes
1 answer

My Django App can't connect to DB through a TypeError

My Django web application can't run because of a TypeError through my DB connection. File "/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/django/db/backends/sqlite3/base.py", line 198, in get_new_connection conn…
2
votes
3 answers

django.db.utils.ProgrammingError: Table doesn't exist

I used two databases, one is default sqlite3 and another mysql. I just created a model Post under app named theapp. I have also created routers.py. This is settings.py DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', …
Khant Htet Naing
  • 128
  • 1
  • 3
  • 11
2
votes
0 answers

django.db.utils.DatabaseError: Cannot add foreign key constraint in MultiDB

I am trying to migrate my app name notifications in to different db (name is notificationcenter) but getting error in Foreign key constraint, I know the limitations of Django in multiple database but both models (i.e notification_template,…
shashank
  • 1,133
  • 2
  • 10
  • 24