【发布时间】:2017-06-17 17:53:05
【问题描述】:
这是我所拥有的:
from django.db import connection
class Command(BaseCommand):
option_list = BaseCommand.option_list
def handle(self, *labels, **options):
with connection.cursor() as cursor:
# Drop database
cursor.execute("drop database if exists test_db;")
# Create database again
cursor.execute("create database test_db;")
在这个块中我可以在哪里关闭数据库游标和连接,我应该调用什么来关闭它们?
【问题讨论】:
标签: python django postgresql connection django-1.8