<s> import os <EOL> import sys <EOL> import optparse <EOL> import labmanager . utils as labmanager_utils <EOL> assert labmanager_utils is not None <EOL> from application import app <EOL> from . views import load as load_views <EOL> from . views . ims_lti import lti_blueprint <EOL> from . views . basic_http import basic_http_blueprint <EOL> from . views . opensocial import opensocial_blueprint <EOL> def load_rlms_modules ( ) : <EOL> """<STR_LIT>""" <EOL> if len ( app . config [ '<STR_LIT>' ] ) == <NUM_LIT:0> : <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> import labmanager . rlms . ext . virtual as virtual <EOL> assert virtual is not None <EOL> for _rlms in app . config [ '<STR_LIT>' ] : <EOL> __import__ ( '<STR_LIT>' % _rlms ) <EOL> def register_blueprints ( ) : <EOL> app . register_blueprint ( basic_http_blueprint , url_prefix = '<STR_LIT>' ) <EOL> app . register_blueprint ( lti_blueprint , url_prefix = '<STR_LIT>' ) <EOL> app . register_blueprint ( opensocial_blueprint , url_prefix = '<STR_LIT>' ) <EOL> app . register_blueprint ( opensocial_blueprint , url_prefix = '<STR_LIT>' ) <EOL> from labmanager . rlms . base import _BLUEPRINTS <EOL> for url , blueprint in _BLUEPRINTS . items ( ) : <EOL> app . register_blueprint ( blueprint , url_prefix = '<STR_LIT>' + url ) <EOL> load_views ( ) <EOL> load_rlms_modules ( ) <EOL> register_blueprints ( ) <EOL> def bootstrap ( ) : pass <EOL> def run ( ) : <EOL> from . db import check_version <EOL> if not check_version ( ) : <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> print >> sys . stderr , "<STR_LIT>" <EOL> sys . exit ( - <NUM_LIT:1> ) <EOL> parser = optparse . OptionParser ( usage = "<STR_LIT>" ) <EOL> parser . add_option ( '<STR_LIT>' , '<STR_LIT>' , dest = '<STR_LIT:port>' , metavar = "<STR_LIT>" , <EOL> help = "<STR_LIT>" , <EOL> type = '<STR_LIT:int>' , default = <NUM_LIT> ) <EOL> parser . add_option ( '<STR_LIT>' , dest = '<STR_LIT>' , help = "<STR_LIT>" , default = False , action = '<STR_LIT:store_true>' ) <EOL> parser . add_option ( '<STR_LIT>' , dest = '<STR_LIT>' , help = "<STR_LIT>" , default = False , action = '<STR_LIT:store_true>' ) <EOL> args , _ = parser . parse_args ( ) <EOL> if args . register_fake_rlms : <EOL> from labmanager . tests . unit . fake_rlms import register_fake <EOL> register_fake ( ) <EOL> if args . testing : <EOL> app . config [ '<STR_LIT>' ] = True <EOL> app . config [ '<STR_LIT>' ] = False <EOL> app . config [ '<STR_LIT>' ] = False <EOL> app . config [ '<STR_LIT>' ] = False <EOL> if app . config [ '<STR_LIT>' ] : <EOL> from flask_debugtoolbar import DebugToolbarExtension <EOL> app . config [ '<STR_LIT>' ] = False <EOL> app . config [ '<STR_LIT>' ] = False <EOL> toolbar = DebugToolbarExtension ( app ) <EOL> port = int ( os . environ . get ( '<STR_LIT>' , args . port ) ) <EOL> app . run ( host = '<STR_LIT>' , port = port , threaded = True ) </s>
