关于使用“from django.contrib.formtools.wizard import FormWizard”
在forms.py中继承特定窗体类中的formwizard。
然后出现以下错误:
ImportError at /APPLICATION/ashish
cannot import name FormWizard
Request Method: POST
Request URL: http://ec2-401-10-25-259.compute-1.amazonaws.com/APPLICATION/ashish
Django Version: 1.3.1
Exception Type: ImportError
Exception Value:
cannot import name FormWizard
Exception Location: /var/www/STACK/DJANGO/PROJECT/APPLICATIO`enter code here`N/myapp/forms.py in <module>, line 28
Python Executable: /usr/bin/python
Python Version: 2.6.6
Python Path:
['/var/www/STACK/DJANGO/PROJECT/APPLICATION',
'/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/STACK/DJANGO/']
Server time: Tue, 4 Feb 2014 01:41:14 -0500
对上述问题添加回溯,希望能提供一些帮助:
TRACEBACK::
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/var/www/stacks/django-apps/hive/apps/accounts/views.py" in sms_code
159. return HttpResponseRedirect(reverse('login'))
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in reverse
391. *args, **kwargs)))
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in reverse
312. possibilities = self.reverse_dict.getlist(lookup_view)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
229. self._populate()
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in _populate
208. for name in pattern.reverse_dict:
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in _get_reverse_dict
229. self._populate()
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in _populate
197. for pattern in reversed(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/STACK/DJANGO/PROJECT/APPLICATION/myapp/views.py" in <module>
15. from forms import HivReportForm, HivReportFormNew, CrossCheckForm
File "//var/www/STACK/DJANGO/PROJECT/APPLICATION/myapp/forms.py" in <module>
28. from django.contrib.formtools.wizard import FormWizard
Exception Type: ImportError at /accounts/smscode/
Exception Value: cannot import name FormWizard
最佳答案
有一种可能性:lib文件夹中有两个django dir。一个是django1.3.1,另一个可能是django1.6.1或更高版本:
如果你已经删除了它,任何人都不需要你的申请。