Questions tagged [makemigrations]

This is the first step in the two step process to sync changes made to the Django model (in python code) with the database.

https://docs.djangoproject.com/en/1.11/ref/django-admin/#django-admin-makemigrations

113 questions
42
votes
28 answers

"no such table" exception

In Django I added models into models.py. After manage.py makemigrations, manage.py migrate raised this exception: django.db.utils.OperationalError: no such table: auth_test_usertranslatorprofile I removed all old migrations and run makemigrations…
Milano
  • 18,048
  • 37
  • 153
  • 353
31
votes
11 answers

Django migrations error KeyError: ('list', u'user')

I am trying to run python manage.py migrate or python manage.py makemigrations I got this error: Running migrations: No migrations to apply. Traceback (most recent call last): File "manage.py", line 10, in
Roberto
  • 1,472
  • 2
  • 16
  • 18
12
votes
4 answers

return database_name == ':memory:' or 'mode=memory' in database_name TypeError: argument of type 'WindowsPath' is not iterable

I am practicing Django but when I command python manage.py makemigration and python manage.py migrate then I got an error as show in the title. the full error is mentioned below: C:\Users\Manan\python projects\djangoandmongo\new_Socrai>python…
Mannan
  • 156
  • 1
  • 1
  • 7
10
votes
1 answer

Renaming models(tables) in Django

so I've already created models in Django for my db, but now want to rename the model. I've change the names in the Meta class and then make migrations/migrate but that just creates brand new tables. I've also tried schemamigration but also not…
Toby Green
  • 101
  • 1
  • 1
  • 3
8
votes
5 answers

Django 2.2.4 - “No migrations to apply” when run migrate after makemigrations

I am trying to do a migration in django 2.2.4 in python 3.7. First I try to make do makemigations: python3 manage.py makemigrations I get: Migrations for 'main': main/migrations/0001_initial.py - Create model TutorialCategory - Create…
user8802333
  • 469
  • 1
  • 8
  • 18
6
votes
2 answers

ProgrammingError at "url" relation "app_model" does not exist LINE 1: SELECT COUNT(*) AS "__count" FROM "app_model"

I've searched every Stack Overflow question on this error but none of the responses helped. I'm getting this error when trying to access the admin page of this particular model (AgentBasicInfo). 'manage.py makemigrations' works fine. 'manage.py…
Valachio
  • 1,025
  • 2
  • 18
  • 40
6
votes
2 answers

django makemigrations to rename field without user input

I have a model with CharField named oldName. I want to rename the field to newName. When I run python manage.py makemigrations, I get a confirmation request "Did you rename model.oldName to model.newName (a CharField)? [y/N]" However, I want to run…
5
votes
1 answer

Run Django manage.py shell commands on elastic beanstalk on AL2

I have my Django service up and running on AWS Elastic Beanstalk (on Amazon Linux 2). eb deploy works perfectly. But I would like to run some functions from shell of Django on by eb or maybe perform migrations on my DB. I am unable to find my…
5
votes
3 answers

Can't add new field in the django model

Django 2.0 I've created a model in Blog app, class Category(models.Model): field1 = models.... field2 = models.... field3 = models.... and after some time I want to add a new field in that model. class Category(models.Model): …
Dead Pool
  • 133
  • 2
  • 9
5
votes
2 answers

How to control table names created by Django migrate

Context: Django 1.7; MySQL 5.6.23; Running on AWS (not sure of exact Linux OS version) I have a Django 1.7 project. When I do the initial makemigrations to build my DB locally on my Windows laptop, I get tables that are prefixed with my app name…
4
votes
1 answer

What is a decent practice for running django `makemigrations` outside of a container-only dev environment

I raise a container with my Django-based App and another container with PostgreSQL, linked to each other network-wise, using docker-compose. If I run the makemigrations outside of a bash session inside my application docker container (linked to the…
Filipe Freire
  • 823
  • 7
  • 21
4
votes
3 answers

Django makemigrations No changes detected in app

I have trouble with my makemigrations command. Note: I have successfully make migrations till now, so it is not the first time I try to make migrations on this project. I have my project in INSTALLED_APPS. Problem: For some reason project stop…
Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97
3
votes
1 answer

django makemigrations raise error after remove a function in models.py

I define a model named Foo which has a FileField named bar, and I define a function baz which is callable used for bar's upload_to arguement in same file. When I removed the bar field and baz funcion and perform makemigrations operations, it raise…
2v Cheng
  • 31
  • 3
3
votes
1 answer

Reordering Initial Migration operations

Every time I try to migrate my initial migration, right after makemigrations, I get errors like : django.db.migrations.exceptions.InvalidBasesError: Cannot resolve bases for [] This can happen if you are inheriting…
Nikolay Marinov
  • 2,381
  • 2
  • 7
  • 12
3
votes
5 answers

Django migrations : relation already exists

I have trouble with django model migrations. I have some models in my app, and I already have some data inside. When I added some models in my application, and I run makemigrations, the app report that there is no change. I know that sometimes…
Marko Zadravec
  • 8,298
  • 10
  • 55
  • 97
1
2 3 4 5 6 7 8