Python 使用South创建Django缓存表?
我们使用South进行模式迁移和数据迁移。现在我需要在Django中启用缓存,这非常简单。这迫使我在终端中使用Python 使用South创建Django缓存表?,python,django,caching,django-south,Python,Django,Caching,Django South,我们使用South进行模式迁移和数据迁移。现在我需要在Django中启用缓存,这非常简单。这迫使我在终端中使用manage.py createcachetable cache\u table。虽然我想用South自动化这个过程。有没有一种方法可以使用South创建缓存表 创建一个新的南方数据迁移(只是一个空白迁移): python manage.py数据迁移 谢谢看起来正是我想要的:) import datetime from south.db import db from south.v2 i
manage.py createcachetable cache\u table
。虽然我想用South自动化这个过程。有没有一种方法可以使用South创建缓存表 创建一个新的南方数据迁移(只是一个空白迁移):python manage.py数据迁移
谢谢看起来正是我想要的:)
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.core.management import call_command # Add this import
class Migration(DataMigration):
def forwards(self, orm):
call_command('createcachetable', 'cache')
def backwards(self, orm):
db.delete_table('cache')
...
import datetime
from south.db import dbs # Import dbs instead of db
from south.v2 import DataMigration
from django.db import models
from django.core.management import call_command # Add this import
class Migration(DataMigration):
def forwards(self, orm):
call_command('createcachetable', 'cache', database='other_database')
def backwards(self, orm):
dbs['other_database'].delete_table('cache')
...