1
votes

Request Method: GET Request URL: http://ec2-145-28-57-102.compute-1.amazonaws.com/reports/ Django Version: 1.3.1 Exception Type: ImportError Exception Value:

cannot import name import_by_path

Exception Location: /usr/lib/python2.6/site-packages/django/contrib/formtools/wizard/storage/init.py in , line 2 Python Executable: /usr/bin/python Python Version: 2.6.6 Python Path:

['/var/www/stacks/apps/project/apps', '/usr/lib64/python26.zip', '/usr/lib64/python2.6', '/usr/lib64/python2.6/plat-linux2', '/usr/lib64/python2.6/lib-tk', '/usr/lib64/python2.6/lib-old', '/usr/lib64/python2.6/lib-dynload', '/usr/lib64/python2.6/site-packages', '/usr/lib/python2.6/site-packages', '/usr/lib/python2.6/site-packages/setuptools-0.6c11-py2.6.egg-info', '/var/www/stacks/apps/']

Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
  101.                             request.path_info)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in resolve
  252.                     sub_match = pattern.resolve(new_path)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in resolve
  250.             for pattern in self.url_patterns:
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in _get_url_patterns
  279.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in _get_urlconf_module
  274.             self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/python2.6/site-packages/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/var/www/stacks/apps/project/apps/reports/urls.py" in <module>
  8. from views import (project_report, project_report_new, CustomReportList, delete_custom_report,
File "/var/www/stacks/apps/project/apps/reports/views.py" in <module>
  15. from forms import PROJECTReportForm, PROJECTReportFormNew, CrossCheckForm 
File "/var/www/stacks/apps/project/apps/reports/forms.py" in <module>
  29. from django.contrib.formtools.wizard.views import SessionWizardView
File "/usr/lib/python2.6/site-packages/django/contrib/formtools/wizard/views.py" in <module>
  13. from django.contrib.formtools.wizard.storage import get_storage
File "/usr/lib/python2.6/site-packages/django/contrib/formtools/wizard/storage/__init__.py" in <module>
  2. from django.utils.module_loading import import_by_path

Exception Type: ImportError at /reports/
Exception Value: cannot import name import_by_path

Exception Type: ImportError at /reports/ Exception Value: cannot import name import_by_path

2

2 Answers

1
votes

The docs state that import_by_path is new in Django 1.6, while the question mentions Django 1.3.1. Perhaps you have both versions installed? Check all directories on Python path.

0
votes

import_by_path is deprecated from Django 1.7 So this is actually because of bug in the way that Django versions are detected:

    if django.get_version() >= "1.7":
        from django.utils.module_loading import import_string
    else:
        from django.utils.module_loading import import_by_path as import_string

will not work for Django >= 1.10 because of the lexical compare.

need to edit and fork the library or in your local env you can change as follows:

Edit site-packages/omnibus/management/commands/omnibusd.py

from django.utils.module_loading import import_string as import_by_path