Rebuilding old (2010) django project in 2012
-
03-07-2021 - |
سؤال
I am trying to make an old Django project run again.
Update #1: I removed the arguments extra_thumbnails and size so the server is running. But now I don't have proper thumbnails of my pictures...
image = ImageWithThumbnailsField(
upload_to='images',
thumbnail={'size': (120, 120)},
extra_thumbnails={
'icon': {'size': (32, 32), 'options': ['crop', 'upscale']},
'large': {'size': (640, 640)},
}
now looks only:
image = ImageField(
upload_to='images')
--
After seemingly having solved issues with old sorl.thumbnail versions and deprecated expressions I now get this error when running
python manage.py runserver
I also tried to copy & paste my old files into a new Django project and get the exactly same error. Maybe someone here has a clue where the problem lies?
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'
I need to re-build the project just for visual documentation locally... so also any hints on how to quickly re-run outdated django-projects are very welcome!!
Thanks a lot!
(using Ubuntu 12.04)
المحلول
A guess into the dark: Remove the keyword argument extra_thumbnails
in the field definition FileField
in the file cityofwindows/models.py
If this does not solve the problem, please post the cityofwindows/models.py file.
نصائح أخرى
You probably uses another version of Django. Install Django 1.0 (https://www.djangoproject.com/download/1.0.4/tarball/) is the easiest why, but not the best. You'd better update your project with the standards of the version 1.3 (see 1.4)