<s> import os <EOL> import sys <EOL> from flask import Flask <EOL> from myapp import settings <EOL> def _createFlaskApp ( debug = False ) : <EOL> '''<STR_LIT>''' <EOL> app = Flask ( settings . APP_NAME ) <EOL> if debug : <EOL> app . config . from_object ( "<STR_LIT>" ) <EOL> else : <EOL> app . config . from_object ( "<STR_LIT>" ) <EOL> return app <EOL> def _registerDebugToolbar ( app ) : <EOL> '''<STR_LIT>''' <EOL> pass <EOL> def _registerAssets ( app ) : <EOL> '''<STR_LIT>''' <EOL> pass <EOL> def _registerApps ( app ) : <EOL> '''<STR_LIT>''' <EOL> for app_name in settings . APPS : <EOL> fq_app_name = ( "<STR_LIT>" % app_name ) <EOL> app_module = __import__ ( ( fq_app_name ) , globals ( ) , locals ( ) , [ ( "<STR_LIT>" % app_name ) ] ) <EOL> if hasattr ( app_module , "<STR_LIT>" ) : <EOL> app . register_module ( app_module . module ) <EOL> else : <EOL> print ( "<STR_LIT>" % fq_app_name ) <EOL> def createApp ( ) : <EOL> if "<STR_LIT>" not in os . environ or os . environ [ "<STR_LIT>" ] == "<STR_LIT>" : <EOL> app = _createFlaskApp ( ) <EOL> else : <EOL> app = _createFlaskApp ( True ) <EOL> _registerDebugToolbar ( app ) <EOL> _registerAssets ( app ) <EOL> _registerApps ( app ) <EOL> return app </s>
