wille.server

Wille Server Module

Using Wille Server.

Let’s start by importing Wille server:

>>> import server

Instantiate a server with some customisations:

>>> server = server.Server(services_dir='examples/services', apps_dir=None, server_port=80, quiet=True)

Once services are loaded and everything is otherwise ok, let’s run the server

>>> server.run(background=True)

Now, take a look at your HTTP server, at http://localhost:port/

When finished, press Ctrl+C to kill the server

class wille.server.Server(server_port=8080, server_visibility='localhost', services_dir='services', apps_dir='apps', wille_root_dir='.', userdata_dir='data', profiles='', neighbour_urls=[], quiet=False, debug=False, reloader=False)

Wille Server

register_app(apps_dir, appname)

Register specified app to server Parameters:

path - path to app appname - a name for serving the app urls - List of URLs with corresponding callback classes
register_apps_dir(apps_dir)

Register all apps from specified directory

resolve_app_url(appname)

Resolves apps URL

resolve_ip(interface_hostname=None)

Resolves server’s public IP

resolve_url()

Resolves server’s URL

run(background=True, multi_thread=True)

Start the server Parameters:

background - Run in background? (default=True) multi_thread - Use multithreaded server to serve

multiple concurrent requests (default=True)

quiet - Quiet operation - avoids printing to console (default=True)

class wille.server.StoppableHTTPServer(server_address, RequestHandlerClass, bind_and_activate=True)

A stoppable HTTP server

class wille.server.ThreadedStoppableHTTPServer(server_address, RequestHandlerClass, bind_and_activate=True)

Handle requests in a separate thread.

class wille.server.WilleHTTPRequestHandler(request, client_address, server)

Map requests according to specified URL patterns

datastore(key=None)

Acquire access to memory datastore If key is specified, retrieves content from that key

input(varname=None, default=None)

Parse input data. Parameters: varname - Get only selected variable (None=get all variables in a dict) default - Default value (returned if variable not found)

match_path(path, urls)

Match path against given set of URL+handler tuples

wille_client()

Get an instance of local wille client

Previous topic

wille.client

Next topic

wille.services

This Page