1,511 questions
0
votes
0
answers
93
views
'django.db.utils.ProgrammingError: relation "users_user" does not exist' error while running ' python manage.py migrate_schemas --shared'
AccrediDoc - Multi-tenant Accreditation Management System
A comprehensive Django-based multi-tenant accreditation management system designed for healthcare organizations in India. Manage NABL, NABH, ...
0
votes
0
answers
40
views
Django-tenants: relation "journal_nav_topnavitem" does not exist even after adding app to SHARED_APPS and running migrate_schemas --shared
I'm working on a multi-tenant Django project using django-tenants with Django 3.2.16. I created an app called journal_nav and initially added it only to TENANT_APPS. Later, I moved it to SHARED_APPS ...
0
votes
1
answer
79
views
How to run Django migrations in Visual Studio 2022
I have created a Django project in my Visual Studio solution. The db.sqlite3 file was also created. There are a few classes in models.py.
class Question(models.Model):
q_id = models.IntegerField() ...
0
votes
0
answers
125
views
ModuleNotFoundError: No module named 'backend' when running my make seed data script in django-admin
I am trying to debug and figure out what the issue is. When trying to search, I just get annoying AI responses which I don't want.
Here is my traceback:
Traceback (most recent call last):
File &...
0
votes
1
answer
79
views
How to resolve circular dependency error in django models
I have 2 apps in my django project
customer app
trades app
Customer app has following tables in models.py
customer_table
trade_plan_table
service_plan_table
customer_payments
trades app has ...
0
votes
2
answers
141
views
Django: No tables found in the database after running migrations
I'm working on a Django project, but I'm facing an issue where no tables are being created in my database even after running migrations.
Django version:5.1.3
Database:MySQL
OS:ubuntu 24.04.1 LTS
1 ...
0
votes
0
answers
77
views
Django migrations failing in Docker container after adding new model
I am running a Django project inside a Docker container, and I am facing an issue with migrations after adding a new model to models.py.
When I try to apply the migrations, the system looks for the ...
1
vote
1
answer
51
views
How to create GeneratedField with lookup from settings file?
While using Django 5.1, I'm trying to create a GeneratedField which should return True or False depending on which file has been uploaded. The model will accept both image- and video files. I want to ...
0
votes
1
answer
60
views
why django makemigration command creates python based code instead of creating sql commands [closed]
why django makemigration command creates python based code instead of creating sql commands, Someone please explain from design decision point of view, and what benefits we get from it.
0
votes
1
answer
131
views
How to solve 'django.db.migrations.exceptions.InconsistentMigrationHistory' error?? (using powershell/VSCode)
I am making a web app (I am a student and this is my first attempt of building a project) using stack: Django, Vue and MySQL. Attaching link to git repo here: https://github.com/yeshapan/...
1
vote
1
answer
53
views
Changes detected after squashmigrations
python manage.py showmigrations shows:
mainapp
[X] 0001_initial
...
[X] 0240_employer_data
[X] 0241_person_metadata
[X] 0242_personemployer_employerworkplace
[X] ...
0
votes
1
answer
81
views
Segmentation Fault (Core Dumped) When Running makemigrations with PostgreSQL in Django
I’m trying to connect my PostgreSQL-17 database to a Django project running in a Conda environment on Ubuntu-24. However, when I run python manage.py makemigrations, I keep encountering the following ...
1
vote
2
answers
246
views
Django migrations: SeparateDatabaseAndState vs --fake
Let's say I have a model:
class MyModel(models.Model):
...
field_no_need_anymore = Charfield(...)
I want to remove field_no_need_anymore, but I don't want to apply changes to the database ...
0
votes
2
answers
98
views
Django manage.py migration related commands not returning anything
I had an issue with migrations in a project I'm working on, a migration was deleted manually and the sync was ruined, I tried a lot of solutions but nothing worked and at the end I decided to backup ...
0
votes
1
answer
76
views
Django makemigrations doesn't create migrations for my app [duplicate]
Here’s a brief overview of what I’ve accomplished so far, to ensure we're all on the same page. Please note that I’m still new to Django, so my approach might not be perfect or even close to what it ...
1
vote
2
answers
102
views
Django `squashmigrations` leaving lots of RemoveField
I am trying to use Django manage.py squashmigrations to reduce the number of migration files and migration operations, after years of accumulation.
Django should supposedly optimize the migrations and ...
0
votes
2
answers
114
views
Dokku Procfile "release: python manage.py migrate" results in a NodeNotFoundError "Migration XYZ dependencies reference nonexistent parent node"
When attempting to deploy to the Dokku testing environment with a Postgres database, I encounter an error while the Procfile is being utilized.
-----> Releasing aha-website-test...
-----> ...
1
vote
0
answers
63
views
How to block migrations that delete a view in django?
When we change the type of a column in Django and run a migration, it does not finish if any view is using the column. However, when we remove a column from the table and run a migration, Django does ...
0
votes
0
answers
61
views
How to handle Parallel GitHub Actions and Migrations in Django + React Projects
I'm working on a Django + React project, and we use GitHub Actions for CI/CD. The typical workflow when a pull request is raised involves running Selenium tests, which require a large dataset in the ...
0
votes
2
answers
64
views
How to get more info on what field differences where found by manage makemigrations
Occasionally when running manage makemigrations in my Django project, I end up with an unexpected migrations.AlterField() entry in my migrations file.
I am aware that these result from Django seeing ...
0
votes
0
answers
49
views
Django migrations operations inside RunPython code
I'm working with data migrations in django, and at some point, I'll have to run migrations.RunPython. The point is that I wish I could execute migrations operations(AddField, AlterField) under certain ...
0
votes
1
answer
105
views
Why does Django still display migrations when none exist?
I'm trying to reset my migrations and start off fresh but I'm getting this really strange issue I can't seem to fix. I started off by deleting the Migrations folder and Deleting every table in ...
0
votes
1
answer
42
views
Unable to update latest database configuration in settings.py in django
I write code on my local machine and then use github to transfer the code to my Amazon AWS EC2 server, I am using AWS Route53 to connect to a domain name and AWS RDS for database (started using ...
1
vote
1
answer
43
views
Can you safely update a Django AppConfig.label?
I'm in the process of merging two Django projects however they have conflicting app names.
For example, the conflicting app names are customer, order, and product which are categorized into ecommerce ...
0
votes
0
answers
59
views
removing data migrations in Django
I have been working on a Django app for a client. throughout development there have been data migrations (data insertions/modifications, not structural changes) that have been specific to the client. ...
1
vote
1
answer
30
views
I am using Django for experiments on websites. There are different versions of Django. Which version is most suitable?
Which version of Django can be implemented as different texts have implemented different versions.
I tried each type of version of Django but could not succeed fully in implementing a small project &...
0
votes
0
answers
85
views
How to Create a New Database and Run Migrations Dynamically in Django?
I have an application where I need to create a new database and run migrations to create tables. Here is my current implementation:
def create_database(db_name):
with connection.cursor() as cursor:...
0
votes
1
answer
330
views
How to order migration files across different apps in django?
I am working on a django project. After some time, I wanted to refactor the code. I wanted to create a new app and move some of my models to that app. Here's an example:
Suppose I have an app named ...
-1
votes
1
answer
97
views
TypeError: 'staticmethod' object is not callable during Django migrations
When I run python manage.py migrate, I encounter the following error:
File "/home/seyedbet/virtualenv/WanderSight/3.9/lib/python3.9/site-packages/django/utils/functional.py", line 57, in ...
0
votes
1
answer
37
views
Django: Maintaining a local set of migrations differing from upstream
I have written patches for a Django project that take forever to be integrated upstream (or may not even be). Due to this, I have local migrations that I need to maintain.
However, due to the way the ...
0
votes
0
answers
30
views
Django Best practices: migration & contenarization [duplicate]
I am working on a Django API and I'd like to add a bit of CI/CD to it.
It dockerize my app with
FROM python:3.12
WORKDIR /app
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements....
1
vote
0
answers
34
views
Trouble with Django migrations: No new migration files created despite all migrations applied
I am encountering an issue in my Django project where new migration files are not being created despite all migrations being applied. I have checked several possible causes, including database schema ...
0
votes
1
answer
92
views
psycopg2.errors.UndefinedTable: relation "mydjangoapp_mymodel" does not exist
I am managing a django app built by third parts.
I have configured in settings.py the connection to a new db
'default': { # changed
'ENGINE': 'django.contrib.gis.db.backends.postgis',
'NAME': ...
0
votes
1
answer
504
views
TypeError: 'class Meta' got invalid attribute(s): manager_inheritance_from_future in Django4.2
I got above error while running the makemiragtions command. So I delete/renamed the existing migration folder and rerun the makemirations command it's is migrated but when I run the migrate I got same ...
0
votes
1
answer
74
views
character varying error for django and postgresql
i used from postgresql for my django rest project.
but when i want to migrate my project i got some error for character varying like below
(myenv) root@srv524469:~/django-paynans# python manage.py ...
0
votes
0
answers
110
views
Django `db_table` not renaming table
This question is (surprisingly) unlike similar ones, which ask about doing this dynamically, or ask how to do it in the first place. This question regards those suggestions not working as expected.
...
0
votes
0
answers
196
views
Create SQL function using Django migrations command
I am using Django Framework in Python with MySQL Database
For adding a table in the database, I create a class in models.py and then run
python manage.py makemigrations. This creates the migration ...
0
votes
1
answer
24
views
How to refactor a couple of fields from one model to another with FK relation
I currently have a model
class Car(models.Model):
name = models.CharField(max_length=20)
manufacturer_name = models.CharField(max_length=20)
manufacturer_url = models.URLField()
Now I ...
-1
votes
1
answer
61
views
Django Installable App. Abstract class with dependencies on it's implementation
In my installable Django application, I have a class called Timer which I intend for users to implement:
class Timer(models.Model):
class Meta:
abstract = True
project = models.ForeignKey(...
0
votes
0
answers
60
views
Unable to do migrations in django
django.db.migrations.exceptions.InconsistentMigrationHistory: Migration admin.0001_initial is applied before its dependency userauths.0001_initial on database 'default'.
I have tried commenting "...
1
vote
1
answer
103
views
migrate error : ...No migrations to apply
I made some changes in the models from my apps and then entered makemigrations and migrate in the terminal.
PS C:\Users\USER 1\frist project\website> python manage.py makemigrations home
No changes ...
1
vote
0
answers
116
views
Django migrations not creating tables on PostgreSQL despite successful execution
Description:
I'm encountering an issue with Django migrations on a PostgreSQL database. Despite running python manage.py migrate successfully without any errors, the tables are not being created in ...
1
vote
2
answers
41
views
Django AUTH_USER_MODEL refers to model 'powerlistapp.appuser' that has not been installed ERROR
i have model as in below
from django.db import models
from django.contrib.auth.models import AbstractUser
class AppUser(AbstractUser):
user_department = models.CharField(max_length=100)
...
0
votes
1
answer
93
views
The issue is i am not able to migrate the changes to the db and not able to make migrations as well
I changed from python 3.8 to 3.12.2 everything is fine but i am not able to migrate dont know why neither its making migrations.
When i do
python manage.py make migrations. This issue comes up:
File &...
0
votes
0
answers
48
views
MySQLdb.OperationalError: and django.db.utils.OperationalError 1054, "Unknown column" after field rename in Django and MySql
I have django app that is connected to MySql database.
I have renamed the field in models.py and succesfuly ran the migration. (the name alteration is written in migrations file)
I have also manually ...
4
votes
2
answers
338
views
Removing a non-nullable Django field with SeparateDatabaseAndState
Let's say I have the following model:
class Product(models.Model):
name = models.CharField(max_length=128)
is_retired = models.BooleanField(default=False)
I want to remove the is_retired ...
0
votes
1
answer
90
views
Django (removal of .auth and .django tables that are created after migrate command)
I have these 10 tables in Django (6-Auth tables and 4 Django tables) I am not using these files in my production project, I thought of removing them but read that its not a good practice to remove. I ...
0
votes
2
answers
1k
views
django migrate with clickhouse
I have a project with two databases: PostgreSQL and Clickhouse.
To interact with Clickhouse, I use the django-clickhouse-backend lib. For a long time, I did not use the created migrations for this ...
1
vote
1
answer
279
views
can you remove old migrations file after changing models location django
I am currently refactoring a django project. It had a few apps with unrelated models (ex: customer in the product app) that I decided to consolidate into a single core app. I use the third method ...
1
vote
1
answer
94
views
Change generated model name without deleting model django
In django, by default, if you have a structure like this
app
├── migrations
└── models
└ example
The generated name of your model will be app_example when executing the command makemigrations.
...