|
| 1 | +============ |
| 2 | +Installation |
| 3 | +============ |
| 4 | + |
| 5 | +This section describes how to install the tinymce application in your Django |
| 6 | +project. |
| 7 | + |
| 8 | + |
| 9 | +Prerequisites |
| 10 | +------------- |
| 11 | + |
| 12 | +The tinymce application requires Django_ version 1.0 or higher. You will also |
| 13 | +need TinyMCE_ version 3.0 or higher and optionally a `language pack`_ for your |
| 14 | +projects languages. If you use the `django-filebrowser`_ application in your |
| 15 | +project, the tinymce application can use it as a browser when including media. |
| 16 | + |
| 17 | +If you want to use the `spellchecker plugin`_ using the supplied view (no PHP |
| 18 | +needed) you must install the `PyEnchant`_ package and dictionaries for your |
| 19 | +project languages. Note that the Enchant needs a dictionary that exactly |
| 20 | +matches your language codes. For example, a dictionary for code ``'en-us'`` |
| 21 | +will not automatically be used for ``'en'``. You can check the availability of |
| 22 | +the Enchant dictionary for the ``'en'`` language code using the following |
| 23 | +Python code:: |
| 24 | + |
| 25 | + import enchant |
| 26 | + enchant.dict_exists('en') |
| 27 | + |
| 28 | +.. _Django: http://www.djangoproject.com/download/ |
| 29 | +.. _TinyMCE: http://tinymce.moxiecode.com/download.php |
| 30 | +.. _`language pack`: http://tinymce.moxiecode.com/download_i18n.php |
| 31 | +.. _`spellchecker plugin`: http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker |
| 32 | +.. _`PyEnchant`: http://pyenchant.sourceforge.net/ |
| 33 | +.. _`django-filebrowser`: http://code.google.com/p/django-filebrowser/ |
| 34 | + |
| 35 | + |
| 36 | +Installation |
| 37 | +------------ |
| 38 | + |
| 39 | +#. Place the ``tinymce`` module in your Python path. You can put it into your |
| 40 | +Django project directory or run ``python setup.py install`` from a shell. |
| 41 | + |
| 42 | +#. Copy the ``jscripts/tiny_mce`` directory from the TinyMCE distribution into |
| 43 | +a directory named ``js`` in your media root. You can override the location in |
| 44 | +your settings (see below). |
| 45 | + |
| 46 | +#. If you want to use any of the views add tinymce your installed applications |
| 47 | +list and URLconf: |
| 48 | + |
| 49 | +``settings.py``:: |
| 50 | + |
| 51 | + INSTALLED_APPS = ( |
| 52 | + ... |
| 53 | + 'tinymce', |
| 54 | + ... |
| 55 | + ) |
| 56 | + |
| 57 | +``urls.py``:: |
| 58 | + |
| 59 | + urlpatterns = patterns('', |
| 60 | + ... |
| 61 | + (r'^tinymce/', include('tinymce.urls')), |
| 62 | + ... |
| 63 | + ) |
| 64 | + |
| 65 | + |
| 66 | +.. _configuration: |
| 67 | + |
| 68 | +Configuration |
| 69 | +------------- |
| 70 | + |
| 71 | +The application can be configured by editing the project's ``settings.py`` |
| 72 | +file. |
| 73 | + |
| 74 | +``TINYMCE_JS_URL`` (default: ``settings.MEDIA_URL + 'js/tiny_mce/tiny_mce.js'``) |
| 75 | + The URL of the TinyMCE javascript file. |
| 76 | + |
| 77 | +``TINYMCE_JS_ROOT`` (default: ``settings.MEDIA_ROOT + 'js/tiny_mce'``) |
| 78 | + The filesystem location of the TinyMCE files. |
| 79 | + |
| 80 | +``TINYMCE_DEFAULT_CONFIG`` (default: ``{'theme': "simple", 'relative_urls': False}``) |
| 81 | + The default TinyMCE configuration to use. See `the TinyMCE manual`_ for all |
| 82 | + options. To set the configuration for a specific TinyMCE editor, see the |
| 83 | + ``mce_attrs`` parameter for the :ref:`widget <widget>`. |
| 84 | + |
| 85 | +``TINYMCE_SPELLCHECKER`` (default: ``False``) |
| 86 | + Whether to use the spell checker through the supplied view. You must add |
| 87 | + ``spellchecker`` to the TinyMCE plugin list yourself, it is not added |
| 88 | + automatically. |
| 89 | + |
| 90 | +``TINYMCE_COMPRESSOR`` (default: ``False``) |
| 91 | + Whether to use the TinyMCE compressor, which gzips all Javascript files into |
| 92 | + a single stream. This makes the overall download size 75% smaller and also |
| 93 | + reduces the number of requests. The overall initialization time for TinyMCE |
| 94 | + will be reduced dramatically if you use this option. |
| 95 | + |
| 96 | +``TINYMCE_FILEBROWSER`` (default: ``True`` if ``'filebrowser'`` is in ``INSTALLED_APPS``, else ``False``) |
| 97 | + Whether to use `django-filebrowser`_ as a custom filebrowser for media |
| 98 | + inclusion. See the `official TinyMCE documentation on custom filebrowsers`_. |
| 99 | + |
| 100 | +Example:: |
| 101 | + |
| 102 | + TINYMCE_JS_URL = 'http://debug.example.org/tiny_mce/tiny_mce_src.js' |
| 103 | + TINYMCE_DEFAULT_CONFIG = { |
| 104 | + 'plugins': "table,spellchecker,paste,searchreplace", |
| 105 | + 'theme': "advanced", |
| 106 | + } |
| 107 | + TINYMCE_SPELLCHECKER = True |
| 108 | + TINYMCE_COMPRESSOR = True |
| 109 | + |
| 110 | +.. _`the TinyMCE manual`: http://wiki.moxiecode.com/index.php/TinyMCE:Configuration |
| 111 | +.. _`official TinyMCE documentation on custom filebrowsers`: http://wiki.moxiecode.com/index.php/TinyMCE:Custom_filebrowser |
0 commit comments