### Install and Start Nginx
Source: https://uwsgi.readthedocs.io/en/latest/_sources/tutorials/Django_and_nginx.rst.txt
Installs the Nginx web server and starts the service. Ensure you have the necessary permissions.
```bash
sudo apt-get install nginx
sudo /etc/init.d/nginx start # start nginx
```
--------------------------------
### Install Django and start a project
Source: https://uwsgi.readthedocs.io/en/latest/_sources/tutorials/Django_and_nginx.rst.txt
Install the Django framework within the activated virtual environment and create a new Django project named 'mysite'.
```bash
pip install Django
django-admin.py startproject mysite
cd mysite
```
--------------------------------
### Start uWSGI with custom PyPy setup file
Source: https://uwsgi.readthedocs.io/en/latest/_sources/PyPy.rst.txt
Start uWSGI and provide a custom Python script for the PyPy plugin's setup using the --pypy-setup option. This allows runtime customization of the plugin's behavior.
```sh
uwsgi --http-socket :9090 --pypy-home /opt/pypy --pypy-lib /opt/libs/libpypy-c.so --pypy-setup /home/foobar/foo.py
```
--------------------------------
### Legion Configuration Examples
Source: https://uwsgi.readthedocs.io/en/latest/_sources/Legion.rst.txt
Examples of how to configure the Legion subsystem in uWSGI ini files, including basic setup, multiple legions, and security options.
```APIDOC
## Basic Legion Configuration
### Description
Configures a basic Legion cluster using multicast.
### Configuration
```ini
[uwsgi]
legion = mycluster 192.168.173.17:4242 98 bf-cbc:hello
legion-node = mycluster 192.168.173.22:4242
legion-node = mycluster 192.168.173.30:4242
legion-node = mycluster 192.168.173.5:4242
```
## Legion with Multiple Legions
### Description
Demonstrates how to join multiple distinct Legions within the same uWSGI instance.
### Configuration
```ini
[uwsgi]
legion = mycluster 192.168.173.17:4242 98 bf-cbc:hello
legion-node = mycluster 192.168.173.22:4242
legion-node = mycluster 192.168.173.30:4242
legion-node = mycluster 192.168.173.5:4242
legion = mycluster2 225.1.1.1:4243 99 aes-128-cbc:secret
legion-node = mycluster2 225.1.1.1:4243
legion = anothercluster 225.1.1.1:4244 91 aes-256-cbc:secret2
legion-node = anothercluster 225.1.1.1:4244
```
## Legion with IV
### Description
Configures a Legion with a specified Initialization Vector (IV) for enhanced security.
### Configuration
```ini
[uwsgi]
legion = mycluster 192.168.173.17:4242 98 bf-cbc:hello thisistheiv
legion-node = mycluster 192.168.173.22:4242
legion-node = mycluster 192.168.173.30:4242
legion-node = mycluster 192.168.173.5:4242
```
```
--------------------------------
### Start uWSGI with PyPy home specified
Source: https://uwsgi.readthedocs.io/en/latest/_sources/PyPy.rst.txt
Start uWSGI and specify the PyPy installation directory using the --pypy-home option. uWSGI will search for libpypy-c.so within this directory.
```sh
uwsgi --http-socket :9090 --pypy-home /opt/pypy
```
--------------------------------
### Install HTML::Mason PSGI Handler
Source: https://uwsgi.readthedocs.io/en/latest/Perl.html
Install the HTML::Mason PSGI handler using CPAN and create a directory for your site. This is the first step in setting up a real-world HTML::Mason example.
```bash
cpan install HTML::Mason::PSGIHandler
mkdir mason
```
--------------------------------
### Run uWSGI Server for PHP
Source: https://uwsgi.readthedocs.io/en/latest/_sources/PHP.rst.txt
Start the uWSGI server with the PHP plugin enabled. This example shows basic process management and the use of the --cheaper option for adaptive process spawning.
```sh
uwsgi -s :3030 --plugin php -M -p 4
```
```sh
# Or abuse the adaptive process spawning with the --cheaper option
uwsgi -s :3030 --plugin php -M -p 40 --cheaper 4
```
--------------------------------
### Run uGreen Chat Example
Source: https://uwsgi.readthedocs.io/en/latest/_sources/uGreen.rst.txt
This command starts the uWSGI server for the ugreenchat application, enabling uGreen and specifying the number of async cores. This is useful for testing Comet applications with multiple concurrent users.
```sh
./uwsgi -s :3031 -w ugreenchat --async 30 --ugreen
```
--------------------------------
### Start GlusterFS Daemon
Source: https://uwsgi.readthedocs.io/en/latest/_sources/GlusterFS.rst.txt
Start the GlusterFS control daemon after installation.
```sh
/opt/glusterfs/sbin/glusterd
```
--------------------------------
### Install and Use uwsgitop
Source: https://uwsgi.readthedocs.io/en/latest/_sources/StatsServer.rst.txt
Install the `uwsgitop` package using pip or easy_install to get a top-like command-line interface that utilizes the uWSGI Stats Server.
```sh
pip install uwsgitop
```
--------------------------------
### HTML::Mason PSGI Handler Setup
Source: https://uwsgi.readthedocs.io/en/latest/_sources/Perl.rst.txt
Steps to set up an HTML::Mason PSGI application, including installing the handler, creating a template, and defining the PSGI application file.
```sh
cpan install HTML::Mason::PSGIHandler
mkdir mason
```
```html
% my $noun = 'World';
% my $ua = $r->headers_in;
% foreach my $hh (keys %{$ua}) {
<% $hh %>
% }
Hello <% $noun %>!
How are ya?
Request <% $r->method %> <% $r->uri %>
```
```perl
use HTML::Mason::PSGIHandler;
my $h = HTML::Mason::PSGIHandler->new(
comp_root => "/Users/serena/uwsgi/mason", # required
);
my $handler = sub {
my $env = shift;
$h->handle_psgi($env);
};
```
--------------------------------
### Install GlusterFS from Source
Source: https://uwsgi.readthedocs.io/en/latest/GlusterFS.html
Configure, build, and install GlusterFS from its official sources. Ensure the installation directory is specified.
```bash
./configure --prefix=/opt/glusterfs
make
make install
```
--------------------------------
### Install uWSGI using setup.py
Source: https://uwsgi.readthedocs.io/en/latest/PyPy.html
Install uWSGI by executing its setup.py script with PyPy. This hardcodes the PyPy home into the uWSGI binary.
```bash
pypy setup.py install
```
--------------------------------
### Running uWSGI with the --namespace option
Source: https://uwsgi.readthedocs.io/en/latest/Namespaces.html
This command starts a uWSGI instance using the `--namespace` option to set a new root filesystem and hostname for the jail. Ensure the specified paths and hostname are correct for your setup.
```bash
uwsgi --socket 127.0.0.1:3031 --chdir /home/uwsgi/uwsgi --uid uwsgi --gid uwsgi --module uwsgicc --master --processes 4 --namespace /ns/001:mybeautifulhostname
```
--------------------------------
### Enable and Start httpd Service
Source: https://uwsgi.readthedocs.io/en/latest/OpenBSDhttpd.html
Commands to enable the httpd service to start on boot and then start it immediately.
```shell
rcctl enable httpd
rcctl start httpd
```
--------------------------------
### Typo Blog Installation and Configuration
Source: https://uwsgi.readthedocs.io/en/latest/Ruby.html
Installs and configures the Typo blogging engine. '--lazy-apps' is vital for apps that are not fork-friendly.
```bash
sudo gem install typo
typo install /tmp/mytypo
./uwsgi -s :3031 --lazy-apps --master --processes 4 --memory-report --rails /tmp/mytypo --post-buffering 4096 --env RAILS_ENV=production
```
--------------------------------
### Install uWSGI with asyncio support using pip
Source: https://uwsgi.readthedocs.io/en/latest/asyncio.html
Install uWSGI with asyncio support using pip. This method uses a pre-defined profile for easier installation.
```bash
CFLAGS="-I/usr/local/include/python3.4" UWSGI_PROFILE="asyncio" pip3 install uwsgi
```
--------------------------------
### Install uwsgitop for statistics
Source: https://uwsgi.readthedocs.io/en/latest/_sources/tutorials/dreamhost.rst.txt
Installs the 'uwsgitop' package into the virtual environment, which is used for monitoring uWSGI statistics.
```sh
venv/bin/easy_install uwsgitop
```
--------------------------------
### Asyncio with aiohttp for HTTP Requests
Source: https://uwsgi.readthedocs.io/en/latest/_sources/asyncio.rst.txt
An advanced example showing how to use asyncio with the aiohttp library to perform asynchronous HTTP GET requests. Remember to install aiohttp (`pip install aiohttp`).
```python
import asyncio
import greenlet
import aiohttp
@asyncio.coroutine
def sleeping(me, f):
yield from asyncio.sleep(2)
response = yield from aiohttp.request('GET', 'http://python.org')
body = yield from response.read_and_close()
# body is a byterray !
f.set_result(body)
me.switch()
def application(environ, start_response):
start_response('200 OK', [('Content-Type','text/html')])
myself = greenlet.getcurrent()
future = asyncio.Future()
asyncio.Task(sleeping(myself, future))
myself.parent.switch()
# this time we use yield, just for fun...
yield bytes(future.result())
```
--------------------------------
### Install Dependencies and Build uWSGI with Coroae Profile
Source: https://uwsgi.readthedocs.io/en/latest/articles/FunWithPerlEyetoyRaspberrypi.html
Installs necessary packages and builds uWSGI with the 'coroae' profile, which is required for the uwsgi-capture plugin.
```bash
sudo apt-get install git build-essential libperl-dev libcoro-perl
git clone https://github.com/unbit/uwsgi
cd uwsgi
make coroae
```
--------------------------------
### Install MongoDB Development Headers and C++ Compiler
Source: https://uwsgi.readthedocs.io/en/latest/GridFS.html
Installs necessary packages on Debian-like systems to build the GridFS plugin.
```bash
apt-get install mongodb-dev g++
```
--------------------------------
### Start GlusterFS Daemon
Source: https://uwsgi.readthedocs.io/en/latest/GlusterFS.html
Start the GlusterFS control daemon after installation. This is a prerequisite for cluster configuration.
```bash
/opt/glusterfs/sbin/glusterd
```
--------------------------------
### Install uWSGI with PyPy support using setup.py
Source: https://uwsgi.readthedocs.io/en/latest/_sources/PyPy.rst.txt
Install uWSGI using its setup.py script from the uWSGI sources. This approach hardcodes the PyPy home into the uWSGI binary.
```sh
pypy setup.py install
```
--------------------------------
### Start Leiningen REPL
Source: https://uwsgi.readthedocs.io/en/latest/_sources/Ring.rst.txt
Command to start the Leiningen REPL (Read-Eval-Print Loop). This is used to install dependencies and interact with the Clojure environment.
```sh
lein repl
```
--------------------------------
### Install Django and Create Project
Source: https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
Install the Django framework using pip and create a new Django project named 'mysite'. Navigate into the project directory.
```bash
pip install Django
django-admin.py startproject mysite
cd mysite
```
--------------------------------
### Create a Basic Ruby/Rack Application
Source: https://uwsgi.readthedocs.io/en/latest/_sources/tutorials/dreamhost.rst.txt
This is a minimal Rack application example. Save this code as `app.ru` in your document root.
```rb
class RackFoo
def call(env)
[200, { 'Content-Type' => 'text/plain'}, ['ciao']]
end
end
run RackFoo.new
```
--------------------------------
### Virtual Environment Setup
Source: https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
Create and activate a Python virtual environment for installing project dependencies. This isolates project packages from the system's Python installation.
```bash
virtualenv uwsgi-tutorial
cd uwsgi-tutorial
source bin/activate
```
--------------------------------
### Route if condition example
Source: https://uwsgi.readthedocs.io/en/latest/_sources/InternalRouting.rst.txt
Demonstrates using the 'route-if' option for lower-level checks. The first example shows a condition that will never match, while the second matches if the subject starts with 'F'.
```ini
; never matches
route-if = equal:FOO;BAR log:never here
; matches
route-if = regexp:FOO;^F log:starts with F
```
--------------------------------
### Configure System Startup with rc.local
Source: https://uwsgi.readthedocs.io/en/latest/_sources/tutorials/Django_and_nginx.rst.txt
Add uWSGI emperor command to /etc/rc.local to ensure it starts automatically on system boot. Logs are directed to a specified file.
```bash
/usr/local/bin/uwsgi --emperor /etc/uwsgi/vassals --uid www-data --gid www-data --daemonize /var/log/uwsgi-emperor.log
```
--------------------------------
### Install Mono Dependencies
Source: https://uwsgi.readthedocs.io/en/latest/_sources/Mono.rst.txt
Installs necessary packages for Mono and ASP.NET development on Debian/Ubuntu systems. Includes build tools, the Mono runtime, XSP web server, and ASP.NET examples for testing.
```sh
apt-get install build-essential python mono-xsp4 asp.net-examples
```
--------------------------------
### Initialize Heroku App and Git Repository
Source: https://uwsgi.readthedocs.io/en/latest/tutorials/heroku_ruby.html
Prepare your local environment by creating a directory, initializing a Git repository, and creating a new Heroku application.
```bash
mkdir uwsgi-heroku
cd uwsgi-heroku
git init .
heroku create --stack cedar
```
--------------------------------
### Configure Nginx Example with Custom Arguments
Source: https://uwsgi.readthedocs.io/en/latest/_sources/Emperor.rst.txt
This example demonstrates how to configure a vassal to run Nginx with specific arguments, such as 'daemon off;', which is crucial for running Nginx in a non-daemonized manner within a uWSGI setup.
```ini
;nginx example
[uwsgi]
privileged-binary-patch-arg = nginx -g "daemon off;"
```
--------------------------------
### uWSGI Routing with GOTO and Labels
Source: https://uwsgi.readthedocs.io/en/latest/InternalRouting.html
Demonstrates advanced routing rules using GOTO to different labels based on host, user-agent, and remote address. Includes examples of logging, rewriting, adding headers, and caching. The 'last:' directive is used to stop routing.
```ini
[uwsgi]
route-host = ^localhost$ goto:localhost
route-host = ^sid\.local$ goto:sid.local
route = .* last:
route-label = sid.local
route-user-agent = .*curl.* redirect:http://uwsgi.it
route-remote-addr = ^192\.168\..* break:403 Forbidden
route = ^/test log:someone called /test
route = \.php$ rewrite:/index.php
route = .* addheader:Server: my sid.local server
route = .* logvar:local=0
route-uri = ^/foo/(.*)\.jpg$ cache:key=$1.jpg
route = .* last:
route-label = localhost
route-user-agent = .*curl.* redirect:http://uwsgi.it
route-remote-addr = ^127\.0\.0\.1$ break:403 Forbidden
route = ^/test log:someone called /test
route = \.php$ rewrite:/index.php
route = .* addheader:Server: my uWSGI server
route = .* logvar:local=1
route-uri = ^/foo/(.*)\.jpg$ cache:key=$1.jpg
route = .* last:
```
--------------------------------
### Nginx Configuration for uWSGI Cache
Source: https://uwsgi.readthedocs.io/en/latest/_sources/WebCaching.rst.txt
Configure Nginx to pass requests to a uWSGI server for caching. This example shows a basic setup.
```nginx
location / {
uwsgi_pass 127.0.0.1:3031;
uwsgi_modifier1 111;
uwsgi_modifier2 3;
uwsgi_param key $request_uri;
}
```
--------------------------------
### Build uWSGI with Rack Support (Manual)
Source: https://uwsgi.readthedocs.io/en/latest/RackQuickstart.html
Manually build a monolithic uWSGI binary with Rack support using 'make'.
```bash
make rack
UWSGI_PROFILE=rack make
make PROFILE=rack
python uwsgiconfig.py --build rack
```
--------------------------------
### Configure Fastrouter for Resubscription
Source: https://uwsgi.readthedocs.io/en/latest/Changelog-2.0.1.html
Example configuration for the fastrouter to support resubscription. It sets up a subscription server and a resubscribe address for federated setups.
```ini
[uwsgi]
fastrouter = 192.168.0.1:3031
fastrouter-subscription-server = 127.0.0.1:5000
fastrouter-resubscribe = 192.168.0.2:5000
```
--------------------------------
### Build JVM Plugin (Core Profile)
Source: https://uwsgi.readthedocs.io/en/latest/JVM.html
Build the JVM plugin with the 'core' profile for a fully modular setup. A JDK installation is required.
```bash
python uwsgiconfig.py --plugin plugins/jvm core
```
--------------------------------
### Run Django Project with uWSGI
Source: https://uwsgi.readthedocs.io/en/latest/_sources/tutorials/Django_and_nginx.rst.txt
Starts a Django project using uWSGI, serving it on a specified port. This is a basic setup for testing Django applications.
```bash
uwsgi --http :8000 --module mysite.wsgi
```
--------------------------------
### Start uWSGI with PyPy library path specified
Source: https://uwsgi.readthedocs.io/en/latest/_sources/PyPy.rst.txt
Start uWSGI and specify the exact path to the PyPy C library using the --pypy-lib option, useful when libpypy-c.so is not in the standard PyPy home.
```sh
uwsgi --http-socket :9090 --pypy-home /opt/pypy --pypy-lib /opt/libs/libpypy-c.so
```
--------------------------------
### Scala JWSGI 'Hello World' Example (Scala-ish Way)
Source: https://uwsgi.readthedocs.io/en/latest/JWSGI.html
An alternative 'Hello World' JWSGI application in Scala, demonstrating a more idiomatic Scala approach for setting headers, including multi-value headers.
```scala
object HelloWorld {
def application(env:java.util.HashMap[String, Object]): Array[Object] = {
val headers = new java.util.HashMap[String, Object]() {
put("Content-Type", "text/html")
put("Server", Array("uWSGI", "Unbit"))
}
return Array(200:java.lang.Integer, headers , "Hello World")
}
}
```
--------------------------------
### Logstash UDP Input Configuration
Source: https://uwsgi.readthedocs.io/en/latest/LogEncoders.html
Example Logstash configuration for receiving msgpack encoded data via UDP. This setup is for debugging purposes.
```logstash configuration
input {
udp {
codec => msgpack {}
port => 1717
}
}
output {
stdout { debug => true }
elasticsearch { embedded => true }
}
```
--------------------------------
### Increase uWSGI Streamers with Processes
Source: https://uwsgi.readthedocs.io/en/latest/_sources/articles/FunWithPerlEyetoyRaspberrypi.rst.txt
Starts uWSGI with multiple processes to handle more concurrent video stream viewers. This example allows up to 10 simultaneous connections.
```sh
./uwsgi --plugin capture --v4l-capture /dev/video0 --http-socket :9090 --psgi uwsgi-capture/rpi-examples/eyetoy.pl --mule="captureloop()" --processes 10
```
--------------------------------
### Run uWSGI FastRouter with Multiple Addresses
Source: https://uwsgi.readthedocs.io/en/latest/Fastrouter.html
Start the FastRouter and bind it to multiple network addresses and a Unix socket. This is a basic setup that requires further configuration for routing.
```bash
uwsgi --fastrouter 127.0.0.1:3017 --fastrouter /tmp/uwsgi.sock --fastrouter @foobar
```
--------------------------------
### Mongrel2 Server Configuration
Source: https://uwsgi.readthedocs.io/en/latest/_sources/Mongrel2.rst.txt
Example configuration for a Mongrel2 server, including host, port, logging, and handler settings. Ensure 'protocol' is set to 'tnetstring' if Jansson is not installed.
```python
main = Server(
uuid="f400bf85-4538-4f7a-8908-67e313d515c2",
access_log="/logs/access.log",
error_log="/logs/error.log",
chroot="./",
default_host="192.168.173.11",
name="test",
pid_file="/run/mongrel2.pid",
port=6767,
hosts = [
Host(name="192.168.173.11", routes={
'/': Handler(send_spec='tcp://192.168.173.11:9999',
send_ident='54c6755b-9628-40a4-9a2d-cc82a816345e',
recv_spec='tcp://192.168.173.11:9998', recv_ident='',
protocol='tnetstring')
})
]
)
settings = {'upload.temp_store':'tmp/mongrel2.upload.XXXXXX'}
servers = [main]
```
--------------------------------
### uwsgi.RegisterSignal, uwsgi.AddTimer, uwsgi.AddRbTimer, uwsgi.PostInit, uwsgi.PostFork
Source: https://uwsgi.readthedocs.io/en/latest/Go.html
Demonstrates how to use the uWSGI API in Go to register signals, add timers, and set hooks for post-initialization and post-fork events.
```APIDOC
## uwsgi.RegisterSignal, uwsgi.AddTimer, uwsgi.AddRbTimer, uwsgi.PostInit, uwsgi.PostFork
### Description
This section shows how to interact with the uWSGI API from a Go application. It covers registering custom signals with associated callback functions, setting up timers for delayed execution, and defining hooks that run after Go initialization or after a fork operation.
### Functions
- **uwsgi.RegisterSignal(signum int, name string, handler func(int))**: Registers a signal handler. `signum` is the signal number, `name` is an optional identifier (e.g., for mules), and `handler` is the function to execute.
- **uwsgi.AddTimer(signum int, seconds int)**: Schedules a timer to trigger a signal after a specified number of seconds.
- **uwsgi.AddRbTimer(signum int, seconds int)**: Schedules a real-time timer (rb_timer) to trigger a signal after a specified number of seconds.
- **uwsgi.PostInit(hook func())**: Sets a function to be called after the Go application has been initialized by uWSGI.
- **uwsgi.PostFork(hook func())**: Sets a function to be called after each fork() operation within the uWSGI process.
### Example Usage
```go
package main
import (
"fmt"
"uwsgi"
)
func hello2(signum int) {
fmt.Println("I am an rb_timer running on mule", uwsgi.MuleId())
}
func hello(signum int) {
fmt.Println("Ciao, 3 seconds elapsed")
}
func postinit() {
uwsgi.RegisterSignal(17, "", hello)
uwsgi.AddTimer(17, 3)
uwsgi.RegisterSignal(30, "mule1", hello2)
uwsgi.AddRbTimer(30, 5)
}
func foofork() {
fmt.Println("fork() has been called")
}
func main() {
uwsgi.PostInit(postinit)
uwsgi.PostFork(foofork)
uwsgi.Run()
}
```
### Configuration Example
```ini
[uwsgi]
socket = 127.0.0.1:3031
master = true
processes = 2
goroutines = 20
mules = 2
memory-report = true
```
```
--------------------------------
### Flask Application Setup
Source: https://uwsgi.readthedocs.io/en/latest/WSGIquickstart.html
Define a simple Flask application. Save this code as 'myflaskapp.py'.
```python
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "I am app 1"
```
--------------------------------
### Run uWSGI with TCP Socket
Source: https://uwsgi.readthedocs.io/en/latest/tutorials/Django_and_nginx.html
Start the uWSGI server using a TCP socket on port 8001 to serve the test.py application. This is useful for initial setup and testing.
```bash
uwsgi --socket :8001 --wsgi-file test.py
```
--------------------------------
### Run Go Application with Master and Processes
Source: https://uwsgi.readthedocs.io/en/latest/Go.html
Start the Go uWSGI server with master mode enabled and multiple processes for better performance and management.
```bash
./helloworld --http :8080 --http-modifier1 11 --master --processes 8
```
--------------------------------
### Increase uWSGI Stream Capacity with Processes
Source: https://uwsgi.readthedocs.io/en/latest/articles/FunWithPerlEyetoyRaspberrypi.html
Starts uWSGI with multiple processes to handle multiple concurrent video stream clients. This example sets up 10 processes for increased capacity.
```bash
./uwsgi --plugin capture --v4l-capture /dev/video0 --http-socket :9090 --psgi uwsgi-capture/rpi-examples/eyetoy.pl --mule="captureloop()" --processes 10
```
--------------------------------
### Install uWSGI Binaries and Plugins
Source: https://uwsgi.readthedocs.io/en/latest/_sources/tutorials/GraphiteAndMetrics.rst.txt
Copies the compiled uWSGI binary and its plugins to system directories.
```sh
sudo mkdir /etc/uwsgi
sudo mkdir /usr/lib/uwsgi
sudo cp uwsgi /usr/bin/uwsgi
sudo cp python_plugin.so /usr/lib/uwsgi
sudo cp rack_plugin.so /usr/lib/uwsgi
sudo cp carbon_plugin.so /usr/lib/uwsgi
```
--------------------------------
### Groovy JWSGI 'Hello World' Example
Source: https://uwsgi.readthedocs.io/en/latest/JWSGI.html
A simple 'Hello World' JWSGI application written in Groovy. This demonstrates the flexibility of JWSGI with other JVM languages.
```groovy
static def Object[] application(java.util.HashMap env) {
def headers = ["Content-Type":"text/html", "Server":"uWSGI"]
return [200, headers, "