【发布时间】:2014-12-20 19:41:10
【问题描述】:
我在 Django 中从类似于以下的脚本调用命令:
#!/usr/bin/python
from django.core.management import call_command
call_command('syncdb')
call_command('runserver')
call_command('inspectdb')
如何将例如 call_command('inspectdb') 的输出分配给变量或文件?
我试过了
var = call_command('inspectdb')
但“var”仍然没有:目的:检查旧数据库中不是由 django 创建的现有表
【问题讨论】: