Showing posts with label python. Show all posts
Showing posts with label python. Show all posts

Tuesday, October 14, 2008

Practical Django Projects - TinyMCE Integration Issue

Following James Bennett's book, I got stalled in Chapter 3 (Customizing The Simple CMS) when I tried to integrate TinyMCE. The solution is rather simple, just move the tiny_mce entry in the urlpatterns one line up.

Here's my urls.py:
from django.conf.urls.defaults import *

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
    # Example:
    # (r'^cms/', include('cms.foo.urls')),

    # Uncomment the admin/doc line below and add 'django.contrib.admindocs'
    # to INSTALLED_APPS to enable admin documentation:
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/(.*)', admin.site.root),
    (r'^tiny_mce/(?P<path>.*)$', 'django.views.static.serve',
        { 'document_root':'C:\\dev\\python\\django\\media\\tinymce\\jscripts\\tiny_mce' },),
    (r'', include('django.contrib.flatpages.urls')),
  
)

By the way, this, this and this are excellent in outlining the code changes from Django 0.96 to 1.0, which should coincide with the book.

Sunday, June 22, 2008

Django notes

I'm learning Django framework. Here are notes that I want to remember as I go...

Create a project:
django-admin.py startproject projectname
Start development server:
python manage.py runserver
Invoke python shell:
python manage.py dbshell
Create or update database:
python manage.py syncdb
Create a new application within a project:
python manage.py startapp appname