A simple Python CMS

submit to reddit                                      



Follow me on Twitter and Google+

Google+







Pyplate

What is Pyplate?

Pyplate is a lightweight Content Management System written in Python.

Pyplate was developed on a Raspberry Pi, so it had to be efficient and compact.  I wanted to build a CMS that performs well right out of the box without having to install any plugins.  

Support for SEO friendly URLs and meta data is built-in, so it's easy for search engines to send relevant traffic to your site.

Pyplate's efficient caching mechanism generates static versions of pages that can be served directly from the web root directory.

The admin area in Pyplate is easy to use, and gives easy access to site settings and a simple editor for creating new posts.

Pyplate can be used for many different types of site including blogs, business websites, embedded UIs and more.  This site is built with Pyplate, and this Raspberry Pi cluster is powered by Pyplate.

Features

Pyplate supports the following features: 

  • dynamic page generation
  • static page generation
  • simple user interface
  • SEO friendly URLs
  • SEO friendly meta-data
  • secure admin login
  • navigation widgets
  • SQLite support
  • One click back up
  • RSS file generation
  • Sitemap generation

 More features coming soon!

Install Pyplate

Requirements

Pyplate is aimed at web developers who want to set up a self hosted web site on a Linux server. It has been tested on a number of platforms including PCs and a Raspberry Pi with 512MB of RAM and a 700MHz CPU.  Pyplate's basic requirements are:

  • Linux (Pyplate has been tested on Raspbian and Ubuntu)
  • Apache2 or Nginx
  • Python 2.7
  • SQLite3

These installation instructions work best if you start with a clean installation of Apache or Nginx.  If you already have Apache or Nginx installed on your server, you should back up your data and configuration files.  

Before you install Pyplate, you should make sure your server is up to date with these commands:

sudo apt-get update
sudo apt-get upgrade

Installation Overview

The basic installation procedure can be summed up as follows:

  • install a webserver and other dependencies using apt-get,
  • download a Pyplate installation script and run it (there are different installations scripts for different servers),
  • note the temporary login details printed by the installation script,
  • delete the script that generates the temporary password,
  • if you're using Apache or Nginx, you need to copy a web server configuration file, 
  • restart your server.

Pyplate will be installed in /usr/share/pyplate, and the web root directory is /var/www.  Once you've completed the installation process, you should see a page like this in your web browser:

Supported Webservers

There are three installation options:

  1. install Pyplate with Apache
  2. install Pyplate with Nginx
  3. install Pyplate with a simple Python web server

Apache is a large, fully featured webserver.  There's a lot of documentation for it, and it has a huge community of users.  The latest version of Pyplate performs well with Apache, especially when page caching is enabled. 

Nginx is a newer webserver than Apache.  It's gaining popularity quickly because it has a reputation for serving static files very quickly.  Nginx can only serve static files, so it has to be used in conjunction with another server for handling dynamic pages.  The Pyplate installation script for Nginx will automatically download and install uWSGI.  It takes quite a long time to compile uWSGI from source, so this is the slowest set up method.  Once set up, Pyplate performs well with Nginx, probably a little better than with Apache.

The simple Python webserver is intended for development purposes.  It's very easy to set up. You just need to install one dependency using apt-get, and then download and run the Pyplate install script.  Restart your server and the Python webserver should be up and running. Performance isn't great compared to Apache or Nginx, but this configuration is the simplest to set up.

 

 

Detailed Installation Instructions

Install Pyplate with Apache

Install Apache, mod WSGI, and Python libraries for libxml2:

sudo apt-get install apache2 libapache2-mod-wsgi python-libxml2

Download and execute the Pyplate installation script for Apache:

curl http://www.pyplate.com/install_apache.sh | sudo bash

Back up the default virtual host file, and replace it with one supplied with Pyplate:

sudo cp /etc/apache2/sites-available/default /etc/apache2/sites-available/default.backup
sudo cp /usr/share/pyplate/sample_configs/apache2/default /etc/apache2/sites-available/default

In newer versions of Apache, the default virtual host file is called 000-default.  

Make sure that you've made a note of the password generated by the installation script, and then delete this file:

sudo rm /usr/share/pyplate/wsgi-scripts/create_passwd_file.py

It's important for your site's security that you delete this file.

Restart Apache:

sudo service apache2 restart

Now visit your server's IP address in a web browser in a browser. You should see a Pyplate sample page.

 

Install Pyplate with Nginx

Install Nginx, libxml2 support for Python, and some packages needed by uWSGI:

sudo apt-get install nginx python-libxml2 build-essential python-dev

Download and run the Pyplate installation script for Nginx:

curl http://www.pyplate.com/install_nginx.sh | sudo bash

Type this command to edit the webserver's crontab file:

sudo crontab -e -u www-data

Enter this command at the end of the file, save the changes you made, and close the file.

@reboot /usr/share/pyplate/uwsgi /usr/share/pyplate/uwsgi_config.ini

In many Linux distributions the nano editor is used to edit crontab files.  To save changes, press control-o and press return.  To close the file, press control-x.

Back up Nginx's default config file:

sudo cp /etc/nginx/sites-available/default /etc/nginx/sites-available/default.backup

Replace it with the sample config file

sudo cp /usr/share/pyplate/sample_configs/nginx/default /etc/nginx/sites-available/default

Make sure that you've made a note of the password generated by the installation script, and then delete this file:

sudo rm /usr/share/pyplate/wsgi-scripts/create_passwd_file.py

It's important for your site's security that you delete this file.

Restart your server

sudo reboot

 

Install Pyplate with a simple Python webserver

Install Python support for libxml2:

sudo apt-get install python-libxml2

Download and run the Pyplate installation script:

curl http://www.pyplate.com/install_simple_server.sh | sudo bash

Make sure that you've made a note of the password generated by the installation script, and then delete this file:

sudo rm /usr/share/pyplate/wsgi-scripts/create_passwd_file.py

It's important for your site's security that you delete this file.

Restart your server:

sudo reboot

This server uses port 8000, so when you visit your server's IP address in a browser, you should add :8000 after the IP address.  You can change the port by editing the 'port' variable in /usr/share/pyplate/wsgi-scripts/pyplate_server.py.

 

Need Help?

Contact me on Twitter at @Pyplate, on Facebook, or on my contact page.  Feel free to request an account for the Pyplate forum.

 

Download Pyplate

You can download Pyplate here: www.pyplate.com/pyplate_install.tar.gz.  You will need to install 7 Zip to open this archive on a Windows computer.

 

Licensing

Pyplate is licensed under the GNU Public license.

 

Development Status

Pyplate is currently in beta testing.  It's quite usable, and it's very reliable.  Pyplate has enough features to build simple web sites and manage them efficiently.

Roadmap

The following features need to be added/completed before Pyplate can be fully released:

  • improve user management
  • add support for plugins
  • develop themes for different types of site
  • develop utilities for managing Pyplate sites
  • test Pyplate in Lighttpd
  • add support for MySQL

Change Log

Pyplate v0.12
July 9, 2014

Changes made in this release:

  • Pyplate now uses the WSGI server interface instead of CGI for improved performance
  • Several security fixes have been added
  • Pyplate includes a simple Python webserver that's very easy to set up.

 

Pyplate v0.11
May 13, 2014

Changes made in this release:

  • posts can now be saved to drafts before they are published
  • the contents of the database can now be exported/imported to/from XML files
  • different themes and layouts can be applied to different pages and categories
  • Youtube videos can be embedded in posts
  • added four new themes


Pyplate v0.10
April 21, 2014

Changes made in this release:

  • two more themes are now included with Pyplate
  • fixed bug in .htaccess file in /usr/share/pyplate/webroot
  • added download/delete/restore buttons to backup page in the admin area
  • added page with fine grain cache controls to th eadmin area
  • added a page in the admin area for comments and sharing templates
  • image Lightbox integrated with CKEditor so that Lightbox can be applied to images from the style menu
  • fixed a bug in the UI where some fields couldn't be left blank
  • fixed a bug where parts of the dashboard are visible to users who aren't logged in

The following versions have been developed:

  • v0.09 - added support for Nginx
  • v0.08 - added CKEditor to editor page, added a page to change the admin password
  • v0.07 - cleaned up code
  • v0.06 - improved the backend
  • v0.05 - added support for an SQLite database
  • v0.04 - developed a selection of widgets
  • v0.03 - added layouts and inline css
  • v0.02 - improved page caching
  • v0.01 - re-wrote the CMS in Python and added an XML flat database
  • v0.00 - 80 line bash script