Home - NucleaPeon/easy-wsgi GitHub Wiki

Welcome to the easy-wsgi wiki!

For the uninitiated, wsgi is software to allow CGI using Python.

Essentially this means you can run scripts on the server by invoking them via the client (through a web browser or ajax/http request)

Table of Contents

Configure Your System

In order to run wsgi, you need the following packages:

  • apache2
  • libapache2-mod-wsgi
On Debian, this means doing the following as root:
apt-get install apache2 libapache2-mod-wsgi

I also prefer to include:

  • pylint
  • git
For the process this wiki documents, I will assume you have access to a LAMP server (apache2 + Linux + wsgi) and have access to the www-data or apache2 user (/var/www directories) and at a minimum, will modify the default html example page that apache comes with.

Initial Configuration of Apache

Just by installing apache on a Debian-based system, you should be able to go to localhost in your web browser and have the index.html page appear fine.

As we are using wsgi, the first step is to go through and have this page parsed through wsgi instead of the default html renderer.

Plain WSGI

Instead of using my easy-wsgi project, let's use regular wsgi so you get a feel for how it functions natively.

First we must configure apache. See the following page for my apache configuration and an explaination of it.

Apache2-Wsgi-Example

Once you have have an apache configuration set up with the .wsgi file containing the Simple Wsgi content, refresh the page and hopefully you will see the "It Works!" page. If not, look for syntax issues in your apache configuration file and make sure to restart apache2 if you made any changes to the wsgi file since your last apache restart.

easy-wsgi

easy-wsgi is the plain wsgi parser with an over-glorified regex replacement mechanism to allow for special <?wsgi ?> tags to enable you to call python scripts directly from html pages, similar to php.

In addition to wsgi tags, easy-wsgi contains Templating for easier-to-read html files and consistent page content without headaches of including tags. It's all automatic.

Go through the easy-wsgi tutorial for creating consistent pages and scripts on our index.html page:

Apache2-Easy-Wsgi-Tutorial

Actual Site Deployment

TODO: Cover permissions, proper dir structure, good practices

Caveats

  • The project is still in beginning incomplete stages of its life.
⚠️ **GitHub.com Fallback** ⚠️