2

I am running django 1.7.2 and python 2.7.

I have a test form that I want to add django-tinymce to my text-areas.

I have followed the tutorial here to install django-tinymce.

However I get the following error on my local development server when I try to run the server:

ImportError: No module named tiny-mce

Here are the steps I took to install django-tinymce:

  1. Installed the app to the virtual env of my project.

    pip install django-tinymce
    
  2. I confirmed the above installation by running pip freeze (django-tinymce==2.2.0).

  3. I then added 'tinymce', to my INSTALLED_APPS

  4. I then added (r'^tinymce/', include('tinymce.urls')), to my urls.

  5. I then added the tinymce js file to my plugins and made a reference to that file on my base.html file:

    <script src="{{ STATIC_URL }}plugins/tinymce/tinymce.min.js"></script>

I have added the following code to my settings.py file:

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

I have double checked that I have correctly installed the django-tinymce to the correct virtual environment.

I have searched Google and SO, but I am stumped at how to solve the error I have, when I try to run my local development server:

ImportError: No module named tiny-mce

EDIT

Here is the form code:

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

Here is the full traceback:

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
user1261774
  • 3,525
  • 10
  • 55
  • 103

1 Answers1

3

Looks like you added 'tiny-mce' instead of 'tinymce' to your INSTALLED_APPS.

Selcuk
  • 57,004
  • 12
  • 102
  • 110