Skip to main content

Simple, flexible app for integrating static, unstructured content in a Django site

Project description

django-pagelets
===============

Simple, flexible app for integrating static, unstructured content in a Django site

Features
--------
- "Pagelets" for adding small pieces of content to otherwise static templates
- CMS "pages" which include any number of pagelets and, if needed, attachments
- Different pagelet content types including HTML and Markdown
- An integrated WYSIWYG editor (`WYMeditor <http://www.wymeditor.org/>`_) which can be selectively enabled/disabled

Required Dependencies
---------------------

- Django admin site
- The `django.core.context_processors.request` context processor

Optional Dependencies
---------------------

- `jQuery 1.3 <http://jquery.com>`_
- `WYMeditor <http://www.wymeditor.org/>`_ (included in pagelets media)


Installation and Setup
----------------------

.. highlight:: python

#. django-pagelets is available on `PyPI <http://pypi.python.org/pypi/django-pagelets>`_, so the easiest way to install it is to use `pip <http://pip.openplans.org/>`_::

pip install django-pagelets

#. Add `pagelets` to INSTALLED_APPS in settings.py and run syncdb::

INSTALLED_APPS = (
...,
'pagelets',
...
)

#. Add `django.core.context_processors.request` to TEMPLATE_CONTEXT_PROCESSORS::

TEMPLATE_CONTEXT_PROCESSORS = (
"django.contrib.auth.context_processors.auth",
"django.core.context_processors.debug",
"django.core.context_processors.i18n",
"django.core.context_processors.media",
"django.contrib.messages.context_processors.messages",
"django.core.context_processors.request", # <----
)

#. Add the pagelets URLs to urls.py, e.g.::

urlpatterns += patterns('',
(r'^pagelets-management/', include('pagelets.urls.management')),
(r'^', include('pagelets.urls.content')),
)

#. In development, you can serve pagelet's static media in urls.py::

import pagelets
path = os.path.join(os.path.dirname(pagelets.__file__), 'media')

urlpatterns += patterns('',
(
r'^%spagelets/(?P<path>.*)' % settings.MEDIA_URL.lstrip('/'),
'django.views.static.serve',
{'document_root': path, 'show_indexes': True}
),
)

#. Visit the admin site, add and save a new page, and click the View on site link. If everything is setup correctly, you should be able to see and edit the content you just added.

Development sponsored by `Caktus Consulting Group, LLC.
<http://www.caktusgroup.com/services>`_.

Project details


Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page