Add django-tinymce + django-filebrowser to projects

Download Template
Adding wysiwyg editors with image uploading is kind of a pain in the ass. The below template may need some cleanup, but it works for me now. This is on ubuntu using apache2, my projects are in /var/www/%{fqdn}%/%{project_name}%/. Make sure to grab [django-filebrowser-no-grappelli-and-uploadify](https://github.com/alexvasi/django-filebrowser-no-grappelli-and-uploadify), I didn't want grappelli.

akonkol
March 5, 2012
/var/www/hatchconfigs.com/hatch

/usr/local/lib/python2.6/dist-packages


easy_install django-tinymce

cd %{path_to_project_dir}%/media
lynx http://www.tinymce.com/track.php?url=http%3A%2F%2Fgithub.com%2Fdownloads%2Ftinymce%2Ftinymce%2Ftinymce_3.4.9.zip
D)ownload
Save to Disk
unzip tinymce_3.4.9.zip


cd /tmp
git clone https://github.com/alexvasi/django-filebrowser-no-grappelli-and-uploadify.git
cd django-filebrowser-no-grappelli-and-uploadify
python setup.py install

cd %{path_to_dist_packages}%/django_filebrowser-3.0-py2.6.egg/filebrowser/media
cp -R filebrowser %{path_to_project_dir}%/media/

cd %{path_to_project_dir}%/media
mkdir uploads
chown -R www-data.www-data uploads


cd %{path_to_project_dir}%
vi settings.py

TINYMCE_JS_URL = '/media/tinymce/jscripts/tiny_mce/tiny_mce_src.js'
URL_FILEBROWSER_MEDIA = '/admin-media/filebrowser/'
FILEBROWSER_URL_TINYMCE = '/media/tinymce/jscripts/tiny_mce/'

TINYMCE_DEFAULT_CONFIG = {
    'plugins': "table,spellchecker,paste,searchreplace",
    'theme': "advanced",
    'theme_advanced_toolbar_location':"top",
    'cleanup_on_startup': True,
}

add "filebrowser" and tinymce to INSTALLED_APPS

:wq!


vi %{app_name}%/models.py
...
from tinymce import models as tinymce_models
...
class Post(models.Model):
        title = models.CharField(max_length=200)
        body = tinymce_models.HTMLField()
:wq!

vi urls.py

add (r'^admin/filebrowser/', include('filebrowser.urls')),(r'^tinymce/', include('tinymce.urls')), to urlpatterns
:wq!


/etc/init.d/apache restart

Comments

a

akonkol
March 15, 2012

You must be logged in to comment.