So I've setup old python project that uses django 1.3 with zc.buildout. When I run the server I get the following error:
Here's full stacktrace:
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.3
Python Version: 2.7.6
Installed Applications:
['filebrowser',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.sitemaps',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'south',
'sugar',
'registration',
'webtopay',
'pagination',
'rest_framework',
'rest_framework.authtoken',
'mptt',
'feincms',
'feincms.module.page',
'esavadai',
'esavadai.documents',
'esavadai.users',
'esavadai.bookmarks',
'esavadai.services',
'esavadai.statistics',
'esavadai.orders',
'esavadai.emails',
'debug_toolbar',
'django_extensions',
'test_utils']
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.csrf.CsrfResponseMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'pagination.middleware.PaginationMiddleware',
'debug_toolbar.middleware.DebugToolbarMiddleware')
Traceback:
File "/home/marijus/workspace/esavadai/eggs/Django-1.3-py2.7.egg/django/core/handlers/base.py" in get_response
89. response = middleware_method(request)
File "/home/marijus/workspace/esavadai/eggs/Django-1.3-py2.7.egg/django/utils/importlib.py" in import_module
35. __import__(name)
File "/home/marijus/workspace/esavadai/project/esavadai/urls.py" in <module>
8. admin.autodiscover()
File "/home/marijus/workspace/esavadai/eggs/Django-1.3-py2.7.egg/django/contrib/admin/__init__.py" in autodiscover
26. import_module('%s.admin' % app)
File "/home/marijus/workspace/esavadai/eggs/Django-1.3-py2.7.egg/django/utils/importlib.py" in import_module
35. __import__(name)
File "/home/marijus/workspace/esavadai/eggs/django_extensions-1.3.9-py2.7.egg/django_extensions/admin/__init__.py" in <module>
23. from django_extensions.admin.widgets import ForeignKeySearchInput
File "/home/marijus/workspace/esavadai/eggs/django_extensions-1.3.9-py2.7.egg/django_extensions/admin/widgets.py" in <module>
7. from django.utils.text import Truncator
Exception Type: ImportError at /
Exception Value: cannot import name Truncator
Here's my buildout file:
[buildout]
parts =
apacheconf
production.py
my.cnf
mkdir
django
# scribd-patch
jquery-ui
tinymce
eggs =
PIL
South
django
django-annoying
django-sugar
python-scribd
django-mptt
django-filebrowser-no-grappelli
django-webtopay
django-pagination
django-registration
feincms
mock
simplejson
djangorestframework
djangorestframework-csv
markdown
extra-paths = project
allowed-eggs-from-site-packages =
PIL
setuptools
distribute
extensions = mr.developer
sources = sources
sources-dir = parts
auto-checkout = *
download-cache = cache
versions = versions
servername = www.myproject.com
serveradmin = [email protected]
[sources]
# my.package = svn http://example.com/svn/my.package/trunk
# some.other.package = git git://example.com/git/some.other.package.git
# bzr.package = bzr bzr+ssh://bazaar.launchpad.net/~user/project/branch/
python-scribd = svn http://python-scribd.googlecode.com/svn/trunk
django-annoying = hg https://bitbucket.org/sirex/django-annoying
django-sugar = git git://github.com/montylounge/django-sugar.git
django-filebrowser-no-grappelli = git git://github.com/wardi/django-filebrowser-no-grappelli.git
django-webtopay = git git://github.com/Motiejus/django-webtopay.git
[versions]
South = 0.7.3
django = 1.3
django-mptt = 0.4.2
django-pagination = 1.0.7
django-registration = 0.8
feincms = 1.4.2
mock = 0.8.0
simplejson = 2.2.1
djangorestframework = 2.2.7
markdown = 2.3.1
django-debug-toolbar = 0.9.4
[django]
recipe = djangorecipe
project = project
settings = production
eggs = ${buildout:eggs}
extra-paths = ${buildout:extra-paths}
wsgi = true
wsgilog = ${buildout:directory}/var/log/wsgi.log
[mkdir]
recipe = z3c.recipe.mkdir
paths =
${buildout:directory}/var/htdocs/static
${buildout:directory}/var/log
[apacheconf]
recipe = collective.recipe.template
input = ${buildout:directory}/etc/apache.conf.in
output = ${buildout:directory}/etc/apache.conf
[production.py]
recipe = collective.recipe.template
input = ${buildout:directory}/etc/production.py.in
output = ${buildout:directory}/etc/production.py
[my.cnf]
recipe = collective.recipe.template
input = ${buildout:directory}/etc/my.cnf.in
output = ${buildout:directory}/etc/my.cnf
[scribd-patch]
recipe = collective.recipe.patch
path = parts/python-scribd/scribd/
patches = patches/scribd-issue-3.diff
[jquery-ui]
recipe = hexagonit.recipe.download
url = http://jquery-ui.googlecode.com/files/jquery-ui-1.8.19.zip
destination = ${buildout:directory}/var/vendor-staticfiles
ignore-existing = true
excludes =
index.html
development-bundle/*
[tinymce]
recipe = hexagonit.recipe.download
url = https://github.com/tinymce/tinymce/archive/3.4.4.zip
destination = ${buildout:directory}/var/vendor-staticfiles
ignore-existing = true
excludes =
tinymce/changelog.txt
examples/*
strip-top-level-dir = true
From what I see Truncator class in django.utils.text is not in django 1.3. If I had to guess some module, whose version wasn't specified in buildout uses this class but didn't when this project was built on django 1.3.
Am I right ? Whether or not - what are my options here ?
The Truncator class was added to Django 1.4. Evidently the version of django-extensions you installed requires Django 1.4 or newer; it is that package that tries to make this import.
You'll have to find and older version of that package that will work with your Django 1.3 setup.
Looking at the django-extensions GitHub repo you can see that they removed compatibility for older Django versions in November last year. The GitHub UI shows us that the earliest tag that contains that commit is 1.3, so the version before that should still work. That version appears to be 2.5, according to the GitHub tags list and the django-extensions PyPI information.
Pin that package in your versions section:
[versions]
# ...
django-extensions = 1.2.5