import traceback import sys import urllib from os.path import abspath, join, dirname from functools import partial, lru_cache from inspect import ismodule, isclass from zest.core import is_async, Config, AsyncFile, get_param_length from zest.httputil import (Request, Response, HTTPError, JsonResponse, RedirectResponse) from zest.helper import default_config from zest.helper.util import get_logger, utc_time from zest.helper.consts import ERROR_TEMPLETE, HTTP_STATUS from zest.routing import Router logger = get_logger('zest.web') G_TEMPLATE_ENGINE = None # global template engine. G_TEMPLATE = {} # global template variable or funtion G_ROUTER = None # global router class App: """ The main entry of a Web app. Each App instance represents an WSGI application, which contains router, template, config, resources and so on. Parameters: