Django manage.py sqclear所有应用程序

时间:2022-06-24 18:00:10

I want to get all apps sql clear code in Django. I can use ./manage.py sqlclear but I need to specify an appname, so is just for one app.

我想在Django中获取所有应用程序sql clear代码。我可以使用./manage.py sqlclear但我需要指定一个appname,因此只适用于一个应用程序。

Is there a way or command to execute sqlclear over all installed apps ?

有没有办法或命令在所有已安装的应用程序上执行sqlclear?

2 个解决方案

#1


1  

Django extensions has reset_db command which is handy.

Django扩展有reset_db命令,这很方便。

Sample run:

样品运行:

(junction)➜  junction git:(master) ✗ ./manage.py reset_db
Monkey patching...

You have requested a database reset.
This will IRREVERSIBLY DESTROY
ALL data in the database "/Users/kracekumar/code/junction/db.sqlite3".
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Reset successful.

#2


0  

You can use sqlflush for printing out database flushing command or directly use flush for removing all data from database.

您可以使用sqlflush打印出数据库刷新命令,也可以直接使用flush从数据库中删除所有数据。

#1


1  

Django extensions has reset_db command which is handy.

Django扩展有reset_db命令,这很方便。

Sample run:

样品运行:

(junction)➜  junction git:(master) ✗ ./manage.py reset_db
Monkey patching...

You have requested a database reset.
This will IRREVERSIBLY DESTROY
ALL data in the database "/Users/kracekumar/code/junction/db.sqlite3".
Are you sure you want to do this?

Type 'yes' to continue, or 'no' to cancel: yes
Reset successful.

#2


0  

You can use sqlflush for printing out database flushing command or directly use flush for removing all data from database.

您可以使用sqlflush打印出数据库刷新命令,也可以直接使用flush从数据库中删除所有数据。