In [1]:
import flask
help(flask)
Help on package flask:

NAME
    flask

DESCRIPTION
    flask
    ~~~~~
    
    A microframework based on Werkzeug.  It's extensively documented
    and follows best practice patterns.
    
    :copyright: 2010 Pallets
    :license: BSD-3-Clause

PACKAGE CONTENTS
    __main__
    _compat
    app
    blueprints
    cli
    config
    ctx
    debughelpers
    globals
    helpers
    json (package)
    logging
    sessions
    signals
    templating
    testing
    views
    wrappers

FUNCTIONS
    escape(...)
        escape(s) -> markup
        
        Convert the characters &, <, >, ', and " in string s to HTML-safe
        sequences.  Use this if you need to display text that might contain
        such characters in HTML.  Marks return value as markup string.

DATA
    appcontext_popped = <flask.signals._FakeSignal object>
    appcontext_pushed = <flask.signals._FakeSignal object>
    appcontext_tearing_down = <flask.signals._FakeSignal object>
    before_render_template = <flask.signals._FakeSignal object>
    current_app = <LocalProxy unbound>
    g = <LocalProxy unbound>
    got_request_exception = <flask.signals._FakeSignal object>
    json_available = <flask._compat._DeprecatedBool object>
    message_flashed = <flask.signals._FakeSignal object>
    request = <LocalProxy unbound>
    request_finished = <flask.signals._FakeSignal object>
    request_started = <flask.signals._FakeSignal object>
    request_tearing_down = <flask.signals._FakeSignal object>
    session = <LocalProxy unbound>
    signals_available = False
    template_rendered = <flask.signals._FakeSignal object>

VERSION
    1.1.2

FILE
    c:\users\eigenaar\anaconda3\lib\site-packages\flask\__init__.py


In [2]:
dir(flask)
Out[2]:
['Blueprint',
 'Config',
 'Flask',
 'Markup',
 'Request',
 'Response',
 '__builtins__',
 '__cached__',
 '__doc__',
 '__file__',
 '__loader__',
 '__name__',
 '__package__',
 '__path__',
 '__spec__',
 '__version__',
 '_app_ctx_stack',
 '_compat',
 '_request_ctx_stack',
 'abort',
 'after_this_request',
 'app',
 'appcontext_popped',
 'appcontext_pushed',
 'appcontext_tearing_down',
 'before_render_template',
 'blueprints',
 'cli',
 'config',
 'copy_current_request_context',
 'ctx',
 'current_app',
 'escape',
 'flash',
 'g',
 'get_flashed_messages',
 'get_template_attribute',
 'globals',
 'got_request_exception',
 'has_app_context',
 'has_request_context',
 'helpers',
 'json',
 'json_available',
 'jsonify',
 'logging',
 'make_response',
 'message_flashed',
 'redirect',
 'render_template',
 'render_template_string',
 'request',
 'request_finished',
 'request_started',
 'request_tearing_down',
 'safe_join',
 'send_file',
 'send_from_directory',
 'session',
 'sessions',
 'signals',
 'signals_available',
 'stream_with_context',
 'template_rendered',
 'templating',
 'url_for',
 'wrappers']
In [3]:
help(flask.config)
Help on module flask.config in flask:

NAME
    flask.config

DESCRIPTION
    flask.config
    ~~~~~~~~~~~~
    
    Implements the configuration related objects.
    
    :copyright: 2010 Pallets
    :license: BSD-3-Clause

CLASSES
    builtins.dict(builtins.object)
        Config
    builtins.object
        ConfigAttribute
    
    class Config(builtins.dict)
     |  Config(root_path, defaults=None)
     |  
     |  Works exactly like a dict but provides ways to fill it from files
     |  or special dictionaries.  There are two common patterns to populate the
     |  config.
     |  
     |  Either you can fill the config from a config file::
     |  
     |      app.config.from_pyfile('yourconfig.cfg')
     |  
     |  Or alternatively you can define the configuration options in the
     |  module that calls :meth:`from_object` or provide an import path to
     |  a module that should be loaded.  It is also possible to tell it to
     |  use the same module and with that provide the configuration values
     |  just before the call::
     |  
     |      DEBUG = True
     |      SECRET_KEY = 'development key'
     |      app.config.from_object(__name__)
     |  
     |  In both cases (loading from any Python file or loading from modules),
     |  only uppercase keys are added to the config.  This makes it possible to use
     |  lowercase values in the config file for temporary values that are not added
     |  to the config or to define the config keys in the same file that implements
     |  the application.
     |  
     |  Probably the most interesting way to load configurations is from an
     |  environment variable pointing to a file::
     |  
     |      app.config.from_envvar('YOURAPPLICATION_SETTINGS')
     |  
     |  In this case before launching the application you have to set this
     |  environment variable to the file you want to use.  On Linux and OS X
     |  use the export statement::
     |  
     |      export YOURAPPLICATION_SETTINGS='/path/to/config/file'
     |  
     |  On windows use `set` instead.
     |  
     |  :param root_path: path to which files are read relative from.  When the
     |                    config object is created by the application, this is
     |                    the application's :attr:`~flask.Flask.root_path`.
     |  :param defaults: an optional dictionary of default values
     |  
     |  Method resolution order:
     |      Config
     |      builtins.dict
     |      builtins.object
     |  
     |  Methods defined here:
     |  
     |  __init__(self, root_path, defaults=None)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |  
     |  __repr__(self)
     |      Return repr(self).
     |  
     |  from_envvar(self, variable_name, silent=False)
     |      Loads a configuration from an environment variable pointing to
     |      a configuration file.  This is basically just a shortcut with nicer
     |      error messages for this line of code::
     |      
     |          app.config.from_pyfile(os.environ['YOURAPPLICATION_SETTINGS'])
     |      
     |      :param variable_name: name of the environment variable
     |      :param silent: set to ``True`` if you want silent failure for missing
     |                     files.
     |      :return: bool. ``True`` if able to load config, ``False`` otherwise.
     |  
     |  from_json(self, filename, silent=False)
     |      Updates the values in the config from a JSON file. This function
     |      behaves as if the JSON object was a dictionary and passed to the
     |      :meth:`from_mapping` function.
     |      
     |      :param filename: the filename of the JSON file.  This can either be an
     |                       absolute filename or a filename relative to the
     |                       root path.
     |      :param silent: set to ``True`` if you want silent failure for missing
     |                     files.
     |      
     |      .. versionadded:: 0.11
     |  
     |  from_mapping(self, *mapping, **kwargs)
     |      Updates the config like :meth:`update` ignoring items with non-upper
     |      keys.
     |      
     |      .. versionadded:: 0.11
     |  
     |  from_object(self, obj)
     |      Updates the values from the given object.  An object can be of one
     |      of the following two types:
     |      
     |      -   a string: in this case the object with that name will be imported
     |      -   an actual object reference: that object is used directly
     |      
     |      Objects are usually either modules or classes. :meth:`from_object`
     |      loads only the uppercase attributes of the module/class. A ``dict``
     |      object will not work with :meth:`from_object` because the keys of a
     |      ``dict`` are not attributes of the ``dict`` class.
     |      
     |      Example of module-based configuration::
     |      
     |          app.config.from_object('yourapplication.default_config')
     |          from yourapplication import default_config
     |          app.config.from_object(default_config)
     |      
     |      Nothing is done to the object before loading. If the object is a
     |      class and has ``@property`` attributes, it needs to be
     |      instantiated before being passed to this method.
     |      
     |      You should not use this function to load the actual configuration but
     |      rather configuration defaults.  The actual config should be loaded
     |      with :meth:`from_pyfile` and ideally from a location not within the
     |      package because the package might be installed system wide.
     |      
     |      See :ref:`config-dev-prod` for an example of class-based configuration
     |      using :meth:`from_object`.
     |      
     |      :param obj: an import name or object
     |  
     |  from_pyfile(self, filename, silent=False)
     |      Updates the values in the config from a Python file.  This function
     |      behaves as if the file was imported as module with the
     |      :meth:`from_object` function.
     |      
     |      :param filename: the filename of the config.  This can either be an
     |                       absolute filename or a filename relative to the
     |                       root path.
     |      :param silent: set to ``True`` if you want silent failure for missing
     |                     files.
     |      
     |      .. versionadded:: 0.7
     |         `silent` parameter.
     |  
     |  get_namespace(self, namespace, lowercase=True, trim_namespace=True)
     |      Returns a dictionary containing a subset of configuration options
     |      that match the specified namespace/prefix. Example usage::
     |      
     |          app.config['IMAGE_STORE_TYPE'] = 'fs'
     |          app.config['IMAGE_STORE_PATH'] = '/var/app/images'
     |          app.config['IMAGE_STORE_BASE_URL'] = 'http://img.website.com'
     |          image_store_config = app.config.get_namespace('IMAGE_STORE_')
     |      
     |      The resulting dictionary `image_store_config` would look like::
     |      
     |          {
     |              'type': 'fs',
     |              'path': '/var/app/images',
     |              'base_url': 'http://img.website.com'
     |          }
     |      
     |      This is often useful when configuration options map directly to
     |      keyword arguments in functions or class constructors.
     |      
     |      :param namespace: a configuration namespace
     |      :param lowercase: a flag indicating if the keys of the resulting
     |                        dictionary should be lowercase
     |      :param trim_namespace: a flag indicating if the keys of the resulting
     |                        dictionary should not include the namespace
     |      
     |      .. versionadded:: 0.11
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)
     |  
     |  ----------------------------------------------------------------------
     |  Methods inherited from builtins.dict:
     |  
     |  __contains__(self, key, /)
     |      True if the dictionary has the specified key, else False.
     |  
     |  __delitem__(self, key, /)
     |      Delete self[key].
     |  
     |  __eq__(self, value, /)
     |      Return self==value.
     |  
     |  __ge__(self, value, /)
     |      Return self>=value.
     |  
     |  __getattribute__(self, name, /)
     |      Return getattr(self, name).
     |  
     |  __getitem__(...)
     |      x.__getitem__(y) <==> x[y]
     |  
     |  __gt__(self, value, /)
     |      Return self>value.
     |  
     |  __iter__(self, /)
     |      Implement iter(self).
     |  
     |  __le__(self, value, /)
     |      Return self<=value.
     |  
     |  __len__(self, /)
     |      Return len(self).
     |  
     |  __lt__(self, value, /)
     |      Return self<value.
     |  
     |  __ne__(self, value, /)
     |      Return self!=value.
     |  
     |  __reversed__(self, /)
     |      Return a reverse iterator over the dict keys.
     |  
     |  __setitem__(self, key, value, /)
     |      Set self[key] to value.
     |  
     |  __sizeof__(...)
     |      D.__sizeof__() -> size of D in memory, in bytes
     |  
     |  clear(...)
     |      D.clear() -> None.  Remove all items from D.
     |  
     |  copy(...)
     |      D.copy() -> a shallow copy of D
     |  
     |  get(self, key, default=None, /)
     |      Return the value for key if key is in the dictionary, else default.
     |  
     |  items(...)
     |      D.items() -> a set-like object providing a view on D's items
     |  
     |  keys(...)
     |      D.keys() -> a set-like object providing a view on D's keys
     |  
     |  pop(...)
     |      D.pop(k[,d]) -> v, remove specified key and return the corresponding value.
     |      If key is not found, d is returned if given, otherwise KeyError is raised
     |  
     |  popitem(self, /)
     |      Remove and return a (key, value) pair as a 2-tuple.
     |      
     |      Pairs are returned in LIFO (last-in, first-out) order.
     |      Raises KeyError if the dict is empty.
     |  
     |  setdefault(self, key, default=None, /)
     |      Insert key with a value of default if key is not in the dictionary.
     |      
     |      Return the value for key if key is in the dictionary, else default.
     |  
     |  update(...)
     |      D.update([E, ]**F) -> None.  Update D from dict/iterable E and F.
     |      If E is present and has a .keys() method, then does:  for k in E: D[k] = E[k]
     |      If E is present and lacks a .keys() method, then does:  for k, v in E: D[k] = v
     |      In either case, this is followed by: for k in F:  D[k] = F[k]
     |  
     |  values(...)
     |      D.values() -> an object providing a view on D's values
     |  
     |  ----------------------------------------------------------------------
     |  Class methods inherited from builtins.dict:
     |  
     |  fromkeys(iterable, value=None, /) from builtins.type
     |      Create a new dictionary with keys from iterable and values set to value.
     |  
     |  ----------------------------------------------------------------------
     |  Static methods inherited from builtins.dict:
     |  
     |  __new__(*args, **kwargs) from builtins.type
     |      Create and return a new object.  See help(type) for accurate signature.
     |  
     |  ----------------------------------------------------------------------
     |  Data and other attributes inherited from builtins.dict:
     |  
     |  __hash__ = None
    
    class ConfigAttribute(builtins.object)
     |  ConfigAttribute(name, get_converter=None)
     |  
     |  Makes an attribute forward to the config
     |  
     |  Methods defined here:
     |  
     |  __get__(self, obj, type=None)
     |  
     |  __init__(self, name, get_converter=None)
     |      Initialize self.  See help(type(self)) for accurate signature.
     |  
     |  __set__(self, obj, value)
     |  
     |  ----------------------------------------------------------------------
     |  Data descriptors defined here:
     |  
     |  __dict__
     |      dictionary for instance variables (if defined)
     |  
     |  __weakref__
     |      list of weak references to the object (if defined)

DATA
    string_types = (<class 'str'>,)

FILE
    c:\users\eigenaar\anaconda3\lib\site-packages\flask\config.py


In [ ]:
from flask import Flask

app = Flask(__name__)


@app.route('/')
def hello():
    return "Hello World!"


@app.route('/<name>')
def hello_name(name):
    return "Hello {}!".format(name)

if __name__ == '__main__':
    app.run()
 * Serving Flask app "__main__" (lazy loading)
 * Environment: production
   WARNING: This is a development server. Do not use it in a production deployment.
   Use a production WSGI server instead.
 * Debug mode: off
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [29/Jan/2021 09:52:17] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [29/Jan/2021 09:52:17] "GET /favicon.ico HTTP/1.1" 200 -
127.0.0.1 - - [29/Jan/2021 09:55:48] "GET /favicon.ico HTTP/1.1" 200 -

Werkt

In [ ]: