我正在尝试将 Django CMS 从 2.2.x 升级到 2.3.5,将 Django 从 1.3.x 升级到 1.4.3。
当我尝试使用 migrate from south 时,出现错误,我无法开始工作。
迁移错误:googlemap:0012_auto__add_field_googlemap_width__add_field_googlemap_height__chg_field 回溯(最近一次通话最后): 文件“manage.py”,第 19 行,在 execute_from_command_line(sys.argv) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/__init__.py”,第 443 行,在 execute_from_command_line 实用程序.execute() 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/__init__.py”,第382行,在执行 self.fetch_command(子命令).run_from_argv(self.argv) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/base.py”,第 196 行,在 run_from_argv self.execute(*args, **options.__dict__) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/core/management/base.py”,第232行,在执行 输出 = self.handle(*args, **options) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/management/commands/migrate.py”,第 108 行,在句柄中 忽略鬼=忽略鬼, 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/__init__.py”,第 213 行,在 migrate_app 成功 = migrator.migrate_many(目标、工作计划、数据库) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py”,第 235 行,在 migrate_many 结果 = 迁移器.__class__.migrate_many(迁移器,目标,迁移,数据库) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py”,第 310 行,在 migrate_many 结果 = self.migrate(迁移,数据库) 迁移中的文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py”,第 133 行 结果 = self.run(迁移) 运行中的文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py”,第 107 行 返回 self.run_migration(migration) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py”,第 81 行,在 run_migration 迁移函数() 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/migration/migrators.py”,第 57 行,在 返回(lambda:方向(orm)) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/cms/plugins/googlemap/migrations/0012_auto__add_field_googlemap_width__add_field_googlemap_height__chg_field.py”,第 19 行,向前 保持默认=假) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/sqlite3.py”,第 31 行,在 add_column field.column: self._column_sql_for_create(table_name, name, field, False), _cache_clear 中的文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/generic.py”,第 44 行 返回函数(自我,表,*args,**opts) _remake_table 中的文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/sqlite3.py”,第 103 行 ", ".join(["%s %s" % (self.quote_name(cname), ctype) for cname, ctype in definitions.items()]), 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/south/db/generic.py”,第 273 行,在执行 cursor.execute(sql,参数) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/db/backends/util.py”,第 44 行,在执行 sql = self.db.ops.last_executed_query(self.cursor, sql, params) 文件“/Users/fguimara/.virtualenvs/twist2/lib/python2.7/site-packages/django/db/backends/__init__.py”,第 595 行,在 last_executed_query 返回 smart_unicode(sql) % u_params TypeError:格式字符串的参数不足
由于未正确迁移,我的项目中出现以下错误
no such column: cmsplugin_googlemap.height
我能做些什么?
编辑:添加了由常规 pip install 安装的 googlemap/models.py
from django.db import models
from django.utils.translation import ugettext_lazy as _
from cms.models import CMSPlugin
class GoogleMap(CMSPlugin):
"""
A google maps integration
"""
title = models.CharField(_("map title"), max_length=100, blank=True,
null=True)
address = models.CharField(_("address"), max_length=150)
zipcode = models.CharField(_("zip code"), max_length=30)
city = models.CharField(_("city"), max_length=100)
content = models.CharField(_("additional content"), max_length=255,
blank=True,
help_text=_('Displayed under address in the bubble.'))
ZOOM_LEVELS = map(lambda c: (c, str(c)), range(22))
zoom = models.PositiveSmallIntegerField(_("zoom level"),
choices=ZOOM_LEVELS, default=13)
lat = models.DecimalField(_('latitude'), max_digits=10, decimal_places=6,
null=True, blank=True,
help_text=_('Use latitude & longitude to fine '
'tune the map position.'))
lng = models.DecimalField(_('longitude'), max_digits=10, decimal_places=6,
null=True, blank=True)
route_planer_title = models.CharField(_("route planer title"),
max_length=150, blank=True, null=True,
default=_('Calculate your fastest way to here'))
route_planer = models.BooleanField(_("route planer"), default=False)
width = models.CharField(_('width'), max_length=6, default='100%',
help_text=_('Plugin width (in pixels or percent).'))
height = models.CharField(_('height'), max_length=6, default='400px',
help_text=_('Plugin height (in pixels).'))
def __unicode__(self):
return u"%s (%s, %s %s)" % (self.get_title(), self.address,
self.zipcode, self.city,)
def get_title(self):
if self.title is None:
return _("Map")
return self.title
def get_lat_lng(self):
if self.lat and self.lng:
return (self.lat, self.lng)