我试图让一个旧的 Django 项目再次运行。
更新 #1:我删除了参数 extra_thumbnails 和 size 以便服务器正在运行。但是现在我没有正确的图片缩略图......
image = ImageWithThumbnailsField(
upload_to='images',
thumbnail={'size': (120, 120)},
extra_thumbnails={
'icon': {'size': (32, 32), 'options': ['crop', 'upscale']},
'large': {'size': (640, 640)},
}
现在看起来只有:
image = ImageField(
upload_to='images')
--
在似乎解决了旧 sorl.thumbnail 版本和不推荐使用的表达式的问题之后,我现在在运行时收到此错误
python manage.py runserver
我还尝试将我的旧文件复制并粘贴到一个新的 Django 项目中并得到完全相同的错误。也许这里有人知道问题出在哪里?
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x2a80510>>
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 88, in inner_run
self.validate(display_num_errors=True)
File "/usr/lib/python2.7/dist-packages/django/core/management/base.py", line 249, in validate
num_errors = get_validation_errors(s, app)
File "/usr/lib/python2.7/dist-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 146, in get_app_errors
self._populate()
File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 61, in _populate
self.load_app(app_name, True)
File "/usr/lib/python2.7/dist-packages/django/db/models/loading.py", line 78, in load_app
models = import_module('.models', app_name)
File "/usr/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/home/me/Documents/wdws/wdws/../wdws/cityofwindows/models.py", line 73, in <module>
class Image(models.Model):
File "/home/me/Documents/wdws/wdws/../wdws/cityofwindows/models.py", line 83, in Image
'large': {'size': (640, 640)},
File "/usr/lib/python2.7/dist-packages/django/db/models/fields/files.py", line 233, in __init__
super(FileField, self).__init__(verbose_name, name, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'extra_thumbnails'
我需要为本地的可视化文档重新构建项目......所以任何关于如何快速重新运行过时的 django-projects 的提示都非常受欢迎!
非常感谢!
(使用 Ubuntu 12.04)