我遇到与“Error: No module named tinymce”类似的问题。
导入“ckeditor”和“tinymce”库时出错。当我运行服务器时,我得到了
ImportError: No module named ckeditor_uploader
但是使用python manage.py shell
导入时没有问题。
以下是错误的详细信息:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 312, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 119, in create
import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named ckeditor_uploader
在我项目的virtualenv中,我安装了以下库:
$ pip list
argparse (1.2.1)
dj-database-url (0.3.0)
dj-static (0.0.6)
Django (1.8)
django-ckeditor (5.0.2)
django-toolbelt (0.0.1)
gunicorn (19.3.0)
pip (1.5.4)
psycopg2 (2.6.1)
setuptools (2.2)
static3 (0.5.1)
wsgiref (0.1.2)
$ cat requirements.txt
Django==1.8
argparse==1.2.1
dj-database-url==0.3.0
dj-static==0.0.6
django-ckeditor==5.0.2
django-toolbelt==0.0.1
gunicorn==19.3.0
psycopg2==2.6.1
static3==0.5.1
wsgiref==0.1.2
models.py:
from django.db import models
from ckeditor.fields import RichTextField
class Posts(models.Model):
name = models.CharField(max_length=200)
content = RichTextField()
def __unicode__(self):
return self.name
setting.py:
INSTALLED_APPS = (
'django.contrib.admin',
...
'django.contrib.staticfiles',
'ckeditor_uploader',
)
CKEDITOR_CONFIGS = {
'awesome_ckeditor': {
'toolbar': 'Basic',
},
}
有什么想法吗?
答案 0 :(得分:0)
您可以使用pip解决此问题。
pip install dj-database-url