webapp module

Main Dokomo Forms entry point.

Execute this script to start the Tornado server and WSGI container. It will ensure that the proper tables and extensions exist in the specified schema of the PostgreSQL database.

The application looks for gettext translation files like locale/{locale}/LC_MESSAGES/dokomoforms.mo

class webapp.Application(session=None, options=<tornado.options.OptionParser object>)[source]

Bases: tornado.web.Application

The tornado.web.Application for Dokomo Forms.

__init__(session=None, options=<tornado.options.OptionParser object>)[source]

Set up the application with handlers and a db connection.

Defines the URLs (with associated handlers) and settings for the application, drops the database schema (if the user selected that option), then prepares the database and creates a session.

webapp.api_url(path, *args, **kwargs)[source]

Prepend the API path to API URLs.


Check that user asked to drop the schema intentionally.

Interrogates the user to make sure that the schema specified by options.schema should be dropped. If the user decides against it, exits the application.

Return the secret from the cookie_secret file.

The cookie secret is in the file <project_directory>/cookie_secret. If the file doesn’t exist, the script will exit with code 1 and tell the user how to generate it.

Returns:the cookie secret as bytes

Start the Tornado web server.

webapp.modify_text(text: str, modifier: str) → str[source]

Modify text for printing to the command line.

  • text – the string to modify
  • modifier – the escape sequence that marks the modifier

the modified string

webapp.setup_file_loggers(log_level: str)[source]

Handles application, Tornado, and SQLAlchemy logging configuration.

webapp.start_http_server(http_server, port)[source]

Start the server, with the option to kill anything using the port.