File manager - Edit - /opt/imh-python/lib/python2.7/site-packages/flask/config.pyo
Back
� ?I�Qc @ sz d Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d e f d � � YZ d e f d � � YZ d S( s� flask.config ~~~~~~~~~~~~ Implements the configuration related objects. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. i����N( t import_stringi ( t string_typest ConfigAttributec B s/ e Z d Z d d � Z d d � Z d � Z RS( s( Makes an attribute forward to the configc C s | | _ | | _ d S( N( t __name__t get_converter( t selft nameR ( ( s; /opt/imh-python/lib/python2.7/site-packages/flask/config.pyt __init__ s c C sE | d k r | S| j | j } | j d k rA | j | � } n | S( N( t Nonet configR R ( R t objt typet rv( ( s; /opt/imh-python/lib/python2.7/site-packages/flask/config.pyt __get__ s c C s | | j | j <d S( N( R R ( R R t value( ( s; /opt/imh-python/lib/python2.7/site-packages/flask/config.pyt __set__# s N( R t __module__t __doc__R R R R ( ( ( s; /opt/imh-python/lib/python2.7/site-packages/flask/config.pyR s t Configc B sD e Z d Z d d � Z e d � Z e d � Z d � Z d � Z RS( s� 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 c C s# t j | | p i � | | _ d S( N( t dictR t root_path( R R t defaults( ( s; /opt/imh-python/lib/python2.7/site-packages/flask/config.pyR S s c C sH t j j | � } | s5 | r"