Apache2 easy wsgi tutorial - NucleaPeon/easy-wsgi GitHub Wiki

Check out the easy-wsgi repository into the /var/www/ folder:

git clone https://github.com/NucleaPeon/easy-wsgi.git

Change the config.py line: WEB_ENTRY_POINT temporarily to /var/www/index.html

Point the WSGIScriptAlias configuration in the Apache2-Wsgi-Example apache conf file to /var/www/easy-wsgi/easy.wsgi

To test easy-wsgi, insert the following code into the index.html page, or create your own html page and link to it with the following:

<?wsgi datetime datetime now ?>

It's important to now note the format of wsgi tags. <? + path.to.module + class (if applicable) + method + *args + ?>

  • path.to.module can have periods in it to denote the module path, but does not include the class
  • class is an attribute that gets passed into the module object. If you don't have a class, but this is in actuality a method, it will get passed to the module just fine too.
  • method gets gets passed into the class object (or module object if only two arguments exist), so if there are no parameters, this object will get called.
Two arguments that aren't covered in the above example but exist are:
  • *args
  • **kwargs
You can implement them like this:
<?wsgi module class method (arg1, arg2, arg3 ..., argN) {kwarg1=foo, kwarg2=bar, ..., kwargN='hello world'} ?>
As you might expect, if an argument has a comma in it, it will break the parsing of args or kwargs. In that case, you will want to encapsulate the value in quotes. For example: module class method ('hello', 'world', 'a, comma, delimited, string, inside')
⚠️ **GitHub.com Fallback** ⚠️