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

Django 3.2.7 - Detect Currently Running Command From Code

TL;DR: Is it possible from within a django project to detect which command is currently running? DETAILS: We have a Django project (running 3.2.7) running which migrations are a little mixed up. There is a config model which has been developed way…
SercioSoydanov
  • 980
  • 10
  • 29
0
votes
1 answer

Django not migrating after makemigrations

I'm working on a Django project with some apps, but from the beginning, I had problems with 'makemigrations' and 'migrate'. These two are giving me some non-sens errors that I can't find solutions to. And from yesterday when I copied someones else…
0
votes
0 answers

python3 manage.py makemigrations not working

I can successfully run git clone 'my repository' I can run 'pip3 install -r requirements.txt'; from the correct directory 'server' When I run the command 'python3 manage.py makemigrations'; nothing happens. When I run 'python3 -m pip show django', I…
0
votes
1 answer

Django Postgres makemigrations only Autofield at 0001_initial.py

Python 3.10.4 Django 4.0.5 PostgreSQL 14 When I start "python manage.py makemigrations" i got the file "0001_initial.py" but all Fields, except autofields, are missing. models.py from django.db import models # Create your models here. class…
Skapi
  • 3
  • 1
0
votes
1 answer

Makemigrations/migrate in django

Could anyone help me solve this problem? I want to add data and time models in Django, but after makemigration, I got this. **You are trying to add a non-nullable field 'MeterReading_DateTime' to mdm_api without a default; we can't do that (the…
jiyan
  • 39
  • 5
0
votes
2 answers

Having TypeError: 'CharField' object is not callable after migrating with django

This is my models.py from my app, the django version is 4.0.4, my python version is 3.10.4. I made all of my models and after making makemigrations in order to generate the database it gives an error code. from enum import unique from django.db…
0
votes
1 answer

when migrating django codes to the database Errno 2 No such file

I am connecting my database with Django codes so when I use python manage.py makemigrations I get the error as no such file py manage.py makemigrations C:\Users\selwy\AppData\Local\Programs\Python\Python310\python.exe: can't open file…
0
votes
0 answers

Django makemigrations: Makemigration not detect fields, only creates id filed

my problem is about makemigrations, it not detect fields and only creates id and foreignkey field. I added studentapp to INSTALLED_APP: INSTALLED_APPS =…
0
votes
1 answer

Django migration gives psycopg2.errors.DuplicateTable: relation error

I have previously restored the database for the system, and while i tried to migrate through the django applicaion, the following error is thrown. What is the possible cause and how can we mitigate such cases. I guess the problem is with the…
hillsonghimire
  • 485
  • 5
  • 13
0
votes
1 answer

Python manage.py command showing ImportError

When hit the command python manage.py makemigrations, I am getting the import error. The error is like this **ImportError : Module 'Backend.apps'does not contain a 'BackendConfigrest_framework'class. Choices are : 'BackendConfig'**
0
votes
1 answer

You are trying to change the nullable field 'email' on customuser to non-nullable without a default

I have two models (UserAddress and CustomUser) in my models.py, the field user address in CustomUser was a many to many field but I decided to change it to a foreign key field. But when I ran python manage.py make migrations it asked me to choose a…
delsa_gh
  • 55
  • 1
  • 6
0
votes
0 answers

Django makemigrations error: "__init__() got an unexpected keywork argument 'max_Length'

I am trying to make migrations to a new app 'users' and keep receiving the error: "TypeError: Field.init() got an unexpected keyword argument 'max_Length'" I previously encountered this error when making migrations on my last app and was able to…
0
votes
1 answer

django.core.exceptions.ValidationError: ['“” value must be a decimal number.']

I got this error while migrating here is my models.py file: from django.db import models from django.conf import settings from decimal import Decimal # Create your models here. class Pharmacy(models.Model): …
0
votes
2 answers

The field 'email' clashes with the field 'email' from model 'account.account'. Django3.2

Newbie in django here. I've been trying to create a simple site with django and I just finished creating the models. However, when I try to makemigrations,I get this: SystemCheckError: System check identified some…
user16987274
0
votes
1 answer

How to connect SQLlite to a project in Django (not an app)

While creating the project I didn't create an app and did everything in the base project. Now I am trying to connect database to my base project(not the app) I tried 'python manage.py makemigrations' but its showing "No changes detected". I even…
Dcoder
  • 27
  • 6