Share this page:

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://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://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://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.  Check out the Pyplate Blog for the latest about Pyplate.

 

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.

 


Comments

Follow me