django makemigrations to rename field without user input

2024/9/8 8:37:04

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 the whole thing inside a docker container and there is no provision to provide the user input. Is there a way to force the migration without need for user input?

PS: I tried --noinput option with makemigrations. In this case migrations are not getting applied.

Answer

Added yes and pipe | before command

python manage.py makemigrations

inside the docker-compoase.yaml file and it should work as shown below:

yes | python manage.py makemigrations
https://en.xdnf.cn/q/73087.html

Related Q&A

Global Python packages in Sublime Text plugin development

1. SummaryI dont find, how Sublime Text plugins developer can use Sublime Text find global Python packages, not Python packages of Sublime Text directory.Sublime Text use own Python environment, not Py…

Can I use pip install to install a module for another users?

Im wish to install Numpy for the www-data user, but I can not log into this user using login. How can I make www-data make us of the Numpy module?To clarify. Numpy is available for root, and for my de…

Set dynamic node shape in network with matplotlib

First time poster here, so please be gentle. :)Im trying to graph a network of characters of different types in Networkx and want to set different node shapes for each type. For example, Id like chara…

How can I strip comments and doc strings from python source code? [closed]

Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.We don’t allow questi…

How to install scipy misc package

I have installed (actually reinstalled) scipy:10_x86_64.whl (19.8MB): 19.8MB downloaded Installing collected packages: scipy Successfully installed scipyBut the misc subpackage is apparently not includ…

How to color surface with stronger contrast

In Matlab, I am trying to plot a function on 2-dim Euclidean space with following codes=.05; x=[-2:s:2+s]; y=[-1:s:3+s]; [X,Y]=meshgrid(x,y); Z=(1.-X).^2 + 100.*(Y-X.*X).^2; surf(X,Y,Z) colormap jetHer…

How to know that the interpreter is Jython or CPython in the code? [duplicate]

This question already has answers here:Can I detect if my code is running on cPython or Jython?(5 answers)Closed 9 years ago.Is there a way to detect that the interpreter that executes the code is Jyt…

Regular expression - replace all spaces in beginning of line with periods

I dont care if I achieve this through vim, sed, awk, python etc. I tried in all, could not get it done.For an input like this:top f1 f2 f3sub1 f1 f2 f3sub2 f1 f2 …

Writing append only gzipped log files in Python

I am building a service where I log plain text format logs from several sources (one file per source). I do not intend to rotate these logs as they must be around forever.To make these forever around f…

How to configure bokeh plot to have responsive width and fixed height

I use bokeh embedded via the components function. Acutally I use :plot.sizing_mode = "scale_width"Which scales according to the width and maintains the aspect ratio. But I would like to have …