Django:python manage.py migrate什么都不做

时间:2021-10-31 18:00:40

I just started learning django, and as i try to apply my migrations the first problem occurs. I start the server up, type

我刚刚开始学习django,当我尝试应用我的迁移时,第一个问题就出现了。我启动服务器,输入

python manage.py migrate

and nothing happens. No error, no crash, just no response.

没有任何反应。没有错误,没有崩溃,没有响应。

Performing system checks...

System check identified no issues (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

May 01, 2017 - 11:36:27
Django version 1.11, using settings 'website.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
python manage.py migrate

And that's the end of my terminal feed. I thought maybe it just looks like nothing happens, but no. The changes weren't applied and I can't proceed any further. Any ideas on what's going on?

这就是我的终端Feed的结束。我想也许只是看起来没有任何反应,但没有。这些变化没有应用,我无法继续进行。关于发生了什么的任何想法?

4 个解决方案

#1


3  

Well, you say that you first start the server and then type in the commands. That's also what the terminal feed you shared shows.

好吧,你说你首先启动服务器,然后输入命令。这也是您共享的终端提要显示的内容。

Do not run the server if you want to run management commands using manage.py.

如果要使用manage.py运行管理命令,请不要运行服务器。

Hit Ctrl+C to exit the server and then run your migration commands, it will work.

按Ctrl + C退出服务器然后运行迁移命令,它将起作用。

#2


1  

Try:

python manage.py makemigrations
python manage.py migrate

#3


0  

Have you tried with parameter?

你试过参数吗?

python manage.py makemigrations <app_name>

python manage.py makemigrations

#4


0  

@adam-karolczak n all

@ adam-karolczak全部

If there are multiple DJANGO Projects, it can happen that DJANGO_SETTINGS_MODULE is set to some other app in environment varibles, the current project manage.py will not point to current project settings thus the error.

如果有多个DJANGO项目,可能会发生DJANGO_SETTINGS_MODULE被设置为环境变量中的其他应用程序,当前项目manage.py将不会指向当前项目设置,从而导致错误。

So, confirm DJANGO_SETTINGS_MODULE in fact points to the settings.py of current project.

因此,确认DJANGO_SETTINGS_MODULE实际上指向当前项目的settings.py。

Close the project if its running viz. ctrl+C. You can also check the server is not running ( linux ) by

如果项目正在运行,请关闭该项目。按Ctrl + C。您还可以检查服务器是否未运行(linux)

ps -ef | grep runserver

Then kill the process ids if they exist. If you confirmed settings.py in DJANGO_MODULE_SETTINGS is for the project you are having issue. Run the following it should resolve.

然后杀死进程ID(如果它们存在)。如果您确认DJANGO_MODULE_SETTINGS中的settings.py适用于您遇到问题的项目。运行以下应解决的问题。

python manage.py makemigrations
python manage.py migrate

Hope it helps.

希望能帮助到你。

#1


3  

Well, you say that you first start the server and then type in the commands. That's also what the terminal feed you shared shows.

好吧,你说你首先启动服务器,然后输入命令。这也是您共享的终端提要显示的内容。

Do not run the server if you want to run management commands using manage.py.

如果要使用manage.py运行管理命令,请不要运行服务器。

Hit Ctrl+C to exit the server and then run your migration commands, it will work.

按Ctrl + C退出服务器然后运行迁移命令,它将起作用。

#2


1  

Try:

python manage.py makemigrations
python manage.py migrate

#3


0  

Have you tried with parameter?

你试过参数吗?

python manage.py makemigrations <app_name>

python manage.py makemigrations

#4


0  

@adam-karolczak n all

@ adam-karolczak全部

If there are multiple DJANGO Projects, it can happen that DJANGO_SETTINGS_MODULE is set to some other app in environment varibles, the current project manage.py will not point to current project settings thus the error.

如果有多个DJANGO项目,可能会发生DJANGO_SETTINGS_MODULE被设置为环境变量中的其他应用程序,当前项目manage.py将不会指向当前项目设置,从而导致错误。

So, confirm DJANGO_SETTINGS_MODULE in fact points to the settings.py of current project.

因此,确认DJANGO_SETTINGS_MODULE实际上指向当前项目的settings.py。

Close the project if its running viz. ctrl+C. You can also check the server is not running ( linux ) by

如果项目正在运行,请关闭该项目。按Ctrl + C。您还可以检查服务器是否未运行(linux)

ps -ef | grep runserver

Then kill the process ids if they exist. If you confirmed settings.py in DJANGO_MODULE_SETTINGS is for the project you are having issue. Run the following it should resolve.

然后杀死进程ID(如果它们存在)。如果您确认DJANGO_MODULE_SETTINGS中的settings.py适用于您遇到问题的项目。运行以下应解决的问题。

python manage.py makemigrations
python manage.py migrate

Hope it helps.

希望能帮助到你。