Python flask.Flask.__init__() Examples
The following are 11
code examples of flask.Flask.__init__().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
flask.Flask
, or try the search function
.
Example #1
Source File: server.py From python-slack-events-api with MIT License | 6 votes |
def __init__(self, signing_secret, endpoint, emitter, server): self.signing_secret = signing_secret self.emitter = emitter self.endpoint = endpoint self.package_info = self.get_package_info() # If a server is passed in, bind the event handler routes to it, # otherwise create a new Flask instance. if server: if isinstance(server, (Flask, Blueprint, LocalProxy)): self.bind_route(server) else: raise TypeError("Server must be an instance of Flask, Blueprint, or LocalProxy") else: Flask.__init__(self, __name__) self.bind_route(self)
Example #2
Source File: base_definitions.py From flask-base-api with MIT License | 6 votes |
def __init__( self, import_name ): Flask.__init__( self, import_name, static_folder='./static', template_folder='./templates' ) # set config app_settings = os.getenv('APP_SETTINGS') self.config.from_object(app_settings) # configure logging handler = logging.FileHandler(self.config['LOGGING_LOCATION']) handler.setLevel(self.config['LOGGING_LEVEL']) handler.setFormatter(logging.Formatter(self.config['LOGGING_FORMAT'])) self.logger.addHandler(handler) # enable CORS CORS(self)
Example #3
Source File: server.py From python-slack-events-api with MIT License | 5 votes |
def __init__(self, msg=None): if msg is None: # default error message msg = "An error occurred in the SlackEventsApiAdapter library" super(SlackEventAdapterException, self).__init__(msg)
Example #4
Source File: web.py From BAR4Py with MIT License | 5 votes |
def __init__(self, import_name): Flask.__init__(self, import_name=import_name) self.args = {} self.dictionary = None self.cameraParameters = None self.markerDetector = None with open(opjoin(opdirname(opabspath(__file__)), 'templates/index.tpl')) as f: self.template_string = f.read() self.js_libs = {} static_js_path = opjoin(opdirname(opabspath(__file__)), 'static/js') for filename in {'three.min.js', 'MTLLoader.js', 'OBJLoader.js', 'barviews.js'}: with open(opjoin(static_js_path, filename)) as f: self.js_libs[filename] = open(opjoin(static_js_path, filename)).read()
Example #5
Source File: web.py From BAR4Py with MIT License | 5 votes |
def __init__(self, import_name): Flask.__init__(self, import_name=import_name) self.args = {} self.dictionary = None self.cameraParameters = None self.markerDetector = None with open(opjoin(opdirname(opabspath(__file__)), 'templates/index.tpl')) as f: self.template_string = f.read() self.js_libs = {} static_js_path = opjoin(opdirname(opabspath(__file__)), 'static/js') for filename in {'three.min.js', 'MTLLoader.js', 'OBJLoader.js', 'barviews.js'}: with open(opjoin(static_js_path, filename)) as f: self.js_libs[filename] = open(opjoin(static_js_path, filename)).read()
Example #6
Source File: web.py From BAR4Py with MIT License | 5 votes |
def __init__(self, import_name): Flask.__init__(self, import_name=import_name) self.args = {} self.dictionary = None self.cameraParameters = None self.markerDetector = None with open(opjoin(opdirname(opabspath(__file__)), 'templates/index.tpl')) as f: self.template_string = f.read() self.js_libs = {} static_js_path = opjoin(opdirname(opabspath(__file__)), 'static/js') for filename in {'three.min.js', 'MTLLoader.js', 'OBJLoader.js', 'barviews.js'}: with open(opjoin(static_js_path, filename)) as f: self.js_libs[filename] = open(opjoin(static_js_path, filename)).read()
Example #7
Source File: web.py From BAR4Py with MIT License | 5 votes |
def __init__(self, import_name): Flask.__init__(self, import_name=import_name) self.args = {} self.dictionary = None self.cameraParameters = None self.markerDetector = None with open(opjoin(opdirname(opabspath(__file__)), 'templates/index.tpl')) as f: self.template_string = f.read() self.js_libs = {} static_js_path = opjoin(opdirname(opabspath(__file__)), 'static/js') for filename in {'three.min.js', 'MTLLoader.js', 'OBJLoader.js', 'barviews.js'}: with open(opjoin(static_js_path, filename)) as f: self.js_libs[filename] = open(opjoin(static_js_path, filename)).read()
Example #8
Source File: __init__.py From CTFd with Apache License 2.0 | 5 votes |
def __init__(self, *args, **kwargs): """Overriden Jinja constructor setting a custom jinja_environment""" self.jinja_environment = SandboxedBaseEnvironment self.session_interface = CachingSessionInterface(key_prefix="session") self.request_class = CTFdRequest # Store server start time self.start_time = datetime.datetime.utcnow() # Create generally unique run identifier self.run_id = sha256(str(self.start_time))[0:8] Flask.__init__(self, *args, **kwargs)
Example #9
Source File: __init__.py From CTFd with Apache License 2.0 | 5 votes |
def __init__(self, app, **options): if "loader" not in options: options["loader"] = app.create_global_jinja_loader() SandboxedEnvironment.__init__(self, **options) self.app = app
Example #10
Source File: __init__.py From CTFd with Apache License 2.0 | 5 votes |
def __init__(self, searchpath, encoding="utf-8", followlinks=False): super(ThemeLoader, self).__init__(searchpath, encoding, followlinks) self.overriden_templates = {}
Example #11
Source File: server.py From aw-server with Mozilla Public License 2.0 | 5 votes |
def __init__(self, name, *args, **kwargs): Flask.__init__(self, name, *args, **kwargs) # Is set on later initialization self.api = None # type: ServerAPI