|
Installation
InstallationThese steps are assuming that you have a relatively recent version of django svn installed and working. If not you'll want to do that first. Step 1 - Download Simple pagesCurrently to get Simple pages you'll have to pull it out of subversion here. Within the checkout is the Simple pages app (the folder names "simplepages") and within that folder is also a folder called "media" which contains some javascript files which are needed for the more advanced features. Step 2 - Add Simplepages To Your ProjectCopy the entire Simple pages application folder (the folder named 'simplepages' that contains 'models.py') to somewhere on your python path. You can also place it within your project root which is typically the directory where your 'settings.py' is found. Step 3 - Configure Your SettingsAdd 'simplepages' to your INSTALLED_APPS setting: INSTALLED_APPS = (
# ...other installed applications,
'simplepages',
)Add 'simplepages.middleware.PageFallbackMiddleware' to the bottom of the MIDDLEWARE_CLASSES setting: MIDDLEWARE_CLASSES = (
# ...other installed middleware
'simplepages.middleware.PageFallbackMiddleware',
)Confirm that your MEDIA_ROOT and MEDIA_URL settings are correct. If you want to tweak things you can change some configuration options (optional). Step 4 - Sync Your DatabaseRun the 'manage.py syncdb' command to create the appropriate tables in the database. The basic system at this point should be working within the admin. You should be able to go into the admin and add site sections and pages. Step 5 - Setup the templatesSimple pages includes basic default templates within the simplepages/templates/pages/ folder. These templates extend the base.html template if you don't have a base.html template you can copy the "sample_base.html" into the root template folder of your project and rename it to "base.html". The page templates place their content in a content block: {% block content %}
Page content would be here
{% endblock %}If your base.html template doesn't have a content block you'll need to add a "content" block to it or change the pages templates to put their content in another block location. You can get more information on the templates. If the templates are setup properly you should now be able to go to the url for one of the pages you created and view them it. Setting up the HTML editor, "Edit page" links, and URL prepopulationNow that the basic system is up and running we can setup these additional nice features. Step 6 - Copying over the javascript filesCopy the three javascript files that are in the simplepages/media/admin/js folder into your admin media js folder. (If you place them somewhere other than the admin media js folder you'll have to update Pages admin js include in the simplepages/pages/models.py file.) Two of these files are new files the third one "CollapsedFieldsets.js" is a slightly updated version of the default django file to fix this bug, so if it asks about overwriting the file say "yes". Step 7 - Updating urls.pyOpen your url config file, most likely urls.py in the root of your project folder and add the simplepages url to it: urlpatterns = patterns('',
# ...other url patterns
(r'^simplepages/', include('simplepages.urls')),
)Step 8 - Including Edit page links on the page.The final step for getting everything working is to include the javascript that is required for the edit this page functionality to appear on the site. Paste the below (also included in the sample_base.html template) into the bottom of your base.html template ideally just before the Unknown end tag for </body> tag:{% if user.is_staff %}
{# Determining if we should load the javascript for displaying admin links #}
<script type="text/javascript" src="{{ MEDIA_URL }}/admin/js/browse_edit.js"></script>
{% endif %}Note that if your admin media folder is someplace other than what is specified above you'll have to update the link to be able to pull the file correctly. All DoneThat's it should be all setup and working now. Using the System - Now that it's setup how to use it. Follow the links below for more information on the different components and configuration.
|
Sign in to add a comment
these instructions not valid for Python 2.5 (django.core import validators)