1
我有SafeUnicode以下进口导入错误:无法导入名称“SafeUnicode”
from django.utils.safestring import SafeUnicode
class FightChoice(TimeStampedModel):
def __unicode__(self):
return SafeUnicode('<strong>{} pts</strong> if <strong>{}</strong> ends the fight by <strong>{}</strong>'.format(
self.points, self.fighter.name, self.howitended.name
))
当我运行在服务器本地也没有问题,运行,但我的生产服务器上,我得到
File "/home/ymorin007/webapps/mmaprophet_com/src/fights/models.py", line 2, in from django.utils.safestring import SafeUnicode ImportError: cannot import name 'SafeUnicode'
任何想法可能是什么问题?
你有什么django版本在本地和生产? – alecxe
1.6.5 prod和1.7c1本地 – Yannick
这可能与这个类不在Django 1.6中有关。 –