我正在尝试使用表单预览django模块示例。在polls_app / mysite / urls.py中:
from django.conf.urls.defaults import *
from mysite.preview import SomeModelFormPreview
from mysite.forms import SomeModelForm
from django import forms
在polls_app / mysite / SomeModelFormPreview.py中:
from django.contrib.formtools.preview
import FormPreview from mysite.models
import SomeModel
class SomeModelFormPreview (FormPreview):
def done(self,request,cleaned_data):
return HttpResponseRedirect("/form/success")
这是我收到的导入错误:
ImportError at / No module named preview Request
Method: GET
Request URL: http://127.0.0.1:8000/
Django Version: 1.2.1
Exception Type: ImportError
Exception Value: No module named preview
Exception Location: /home/adam/Desktop/polls_app/mysite/../mysite/urls.py in <module>, line 4 Python
Executable: /usr/bin/python Python
Version: 2.6.2 Python
Path: ['/home/adam/Desktop/polls_app/mysite',
'/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk',
'/usr/lib/python2.6/lib-old',
'/usr/lib/python2.6/lib-dynload',
'/usr/lib/python2.6/dist-packages',
'/usr/lib/python2.6/dist-packages/PIL',
'/usr/lib/python2.6/dist-packages/gst-0.10',
'/var/lib/python-support/python2.6',
'/usr/lib/python2.6/dist-packages/gtk-2.0',
'/var/lib/python-support/python2.6/gtk-2.0',
'/usr/local/lib/python2.6/dist-packages']
Server time: Mon, 12 Jul 2010 11:16:13 -0500
答案 0 :(得分:0)
似乎mysite.preview
不存在。那是你看到的错误。这可能是循环包含或名称不正确的结果。