Javascript django ImportError:没有名为tiny mce的模块
我正在运行django 1.7.2和python 2.7 我有一个测试表单,我想添加到我的文本区域 我按照教程安装了django tinymce 但是,当我尝试运行服务器时,在本地开发服务器上出现以下错误:Javascript django ImportError:没有名为tiny mce的模块,javascript,python,django,tinymce,django-tinymce,Javascript,Python,Django,Tinymce,Django Tinymce,我正在运行django 1.7.2和python 2.7 我有一个测试表单,我想添加到我的文本区域 我按照教程安装了django tinymce 但是,当我尝试运行服务器时,在本地开发服务器上出现以下错误: ImportError: No module named tiny-mce 以下是我安装django tinymce的步骤: 已将应用程序安装到我的项目的虚拟环境 pip install django-tinymce 我通过运行pip freeze(django tinymce==2.
ImportError: No module named tiny-mce
以下是我安装django tinymce的步骤:
pip install django-tinymce
'tinymce',
添加到我安装的应用程序中
(r'^tinymce/',include('tinymce.url'),
TINYMCE_JS_URL = os.path.join(STATIC_URL, 'plugins/tinymce/tinymce.min.js')
TINYMCE_DEFAULT_CONFIG = {
'plugins' :'table, spellchecker, paste, searchreplace',
'theme' : "advanced",
'cleanup_on_startup ':True ,
'custom_undo_redo_levels':10 ,
}
TINYMCE_SPELLCHECKER = True
TINYMCE_COMPRESSOR = True
我已仔细检查是否已将django tinymce正确安装到正确的虚拟环境中
我搜索过谷歌等,但当我尝试运行本地开发服务器时,我被如何解决我的错误所困扰:
导入错误:没有名为tiny mce的模块
编辑
以下是表格代码:
from tinymce.widgets import TinyMCE
....
class SummaryDetailsForm(forms.ModelForm):
required_css_class = 'required'
def __init__(self, available_languages, language_preference, *args, **kwargs):
"""
available_languages should be a valid choices list
"""
super(SummaryDetailsForm, self).__init__(*args, **kwargs)
self.fields['language_code'] = forms.ChoiceField(choices=available_languages, initial=language_preference, label=_('Language'),)
summary_details = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 30}))
class Meta:
model = SummaryDetails
以下是完整的回溯:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\6233114\desktop\zoodal\env\lib\site-packages\django\core\manage
ment\__init__.py", line 385, in execute_from_command_line
utility.execute()
File "C:\Users\6233114\desktop\zoodal\env\lib\site-packages\django\core\manage
ment\__init__.py", line 354, in execute
django.setup()
File "C:\Users\6233114\desktop\zoodal\env\lib\site-packages\django\__init__.py
", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\6233114\desktop\zoodal\env\lib\site-packages\django\apps\regist
ry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "C:\Users\6233114\desktop\zoodal\env\lib\site-packages\django\apps\config
.py", line 87, in create
module = import_module(entry)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named tiny-mce
回溯(最近一次呼叫最后一次):
文件“manage.py”,第10行,在
从命令行(sys.argv)执行命令
文件“C:\Users\6233114\desktop\zoodal\env\lib\site packages\django\core\manage
“从命令行执行”中的第385行
utility.execute()
文件“C:\Users\6233114\desktop\zoodal\env\lib\site packages\django\core\manage
“执行”中的第354行
django.setup()
文件“C:\Users\6233114\desktop\zoodal\env\lib\site packages\django\\uuuu init\uuuu.py
,第21行,在设置中
应用程序。填充(设置。已安装的应用程序)
文件“C:\Users\6233114\desktop\zoodal\env\lib\site packages\django\apps\regist
ry.py”,第85行,填写
app_config=AppConfig.create(条目)
文件“C:\Users\6233114\desktop\zoodal\env\lib\site packages\django\apps\config
.py”,创建中的第87行
模块=导入模块(条目)
文件“c:\python27\Lib\importlib\\uuuu init\uuuuu.py”,第37行,在导入模块中
__导入(名称)
ImportError:没有名为tiny mce的模块
看起来您在已安装的应用程序中添加了'tiny-mce'
而不是'tinymce'
。您能显示问题3的所有回溯吗。然后,我在安装的应用程序中添加了“tinymce”,这让我感到相当尴尬。这么愚蠢的错误。谢谢你的帮助。@Selcuk,哦,上帝,你说得对,伙计!对不起,我对你的回答有疑问。:)