Thanks Chatchai.
Unfortunately, integration of tiny_mce still eludes me. It seems that
django is not looking in the proper directory for tiny_mce.js. But I
can't see why, despite generous off-list help from kind-soul Peter.
1) I've reviewed and documented my configuration below and would be
truly grateful if someone could point out the error or my way.
2) Also, at one point I though the problem might be due to improper
file permissions. So I've opened tiny_mce.js and change_form.html wide
open. Didn't help, but I suspect it may have created a security
problem. Can anyone tell me how to set the permissions correctly?
Lloyd
Review of tiny_mce configuration:
1) Bennett:p23
"In urls.py, add a new line..."
**** my urls.py *****
from django.conf.urls.defaults import *
urlpatterns = patterns('',
# Example:
# (r'^cms/', include('cms.foo.urls')),
# Uncomment this for admin:
(r'^admin/', include('django.contrib.admin.urls')),
(r'^tiny_mce/(?P<path>.*)$','django.views.static.serve',
{ 'document_root': '/home/lloyd/
django/media/jscripts/tiny_mce' }),
(r'', include('django.contrib.flatpages.urls')),
)
**********************
2) Bennett:p24
"Replace the /path-to-tiny_mce/..."
See above.
2a) Confirm path to tiny_mce
Entered in browser:
http://192.168.1.4:8000/tiny_mce/tiny_mce.js
Browser returned: var tinymce={majorVersion:'3',minorVersion:'0.8',...
3) Bennett:p25
"So inside your templates directory, create an admin directory. Then
create a flatpages directory inside of admin and a flatpage
subdirectory inside of flatpages. Finally copy the change_form
template..."
lloyd@Discovery:~/django/templates/admin/flatpages/flatpage$ ls -l
total 4
-rwxrwxrwx 1 lloyd lloyd 3493 2008-07-08 02:16 change_form.html
4) Bennett:p25
"Now you can open up the change_form.html template in your template
directory and edit it..."
{% extends "admin/base_site.html" %}
{% load i18n admin_modify adminmedia %}
{% block extrahead %}{{ block.super }}
<script type="text/javascript" src="../../../jsi18n/"></script>
<script type="text/javascript" src="tiny_mce/tiny_mce.js"></script>
<script type="text/javascript">
tinyMCE.init({
mode: "textareas",
theme: "simple"
});
</script>
5) Test
Enter in browser:
192.168.1.4:8000/admin/ and advance to change form.
Output of runserver:
[08/Jul/2008 15:37:57] "GET /admin/ HTTP/1.1" 200 4851
[08/Jul/2008 15:38:00] "GET /admin/flatpages/flatpage/ HTTP/1.1" 200
2817
[08/Jul/2008 15:38:06] "GET /admin/flatpages/flatpage/2/ HTTP/1.1" 200
5186
[08/Jul/2008 15:38:07] "GET /admin/jsi18n/ HTTP/1.1" 200 803
[08/Jul/2008 15:38:07] "GET /admin/flatpages/flatpage/2/tiny_mce/
tiny_mce.js HTTP/1.1" 404 1780
Clearly django is looking for tiny_mce.js in wrong place.
6) Confirm location of tiny_mce:
lloyd@Discovery:~/django/media/jscripts/tiny_mce$ ls -l
total 424
-rw-r--r-- 1 lloyd lloyd 453 2008-07-07 16:12 example.html
-rw-r--r-- 1 lloyd lloyd 1617 2008-07-07 16:12 textareas.js
-rwxrwxrwx 1 lloyd lloyd 153025 2008-07-07 16:12 tiny_mce.js
-rw-r--r-- 1 lloyd lloyd 7145 2008-07-07 16:12 tiny_mce_popup.js
-rw-r--r-- 1 lloyd lloyd 251714 2008-07-07 16:12 tiny_mce_src.js
7) Let's look at settings.py:
TEMPLATE_DIRS = (
# Put strings here, like "/home/html/django_templates" or "C:/www/
django/templates".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
'/home/lloyd/django/templates',
8) QUESTION?????
Why is django looking for tiny_mce in .../admin/flatpages/flatpage ?