Famcy/__init__.py
def create_app(famcy_id, production=False):
	"""
	Main creation function of the famcy application. 
	Can set to different factory settings in the future. 
	"""
	# Famcy Manager that manage all global vars, imports, 
	# file systems, http
	FManager = FamcyManager(famcy_id, famcy_dir, production=production)
	globals()["FManager"] = FManager

	# globals()["SubmissionObjectTable"] = IdTable()

	# Header definitions
	FManager["CUSTOM_STATIC_PATH"] = FManager.console + "_static_"

	# Sijax, submission related
	FManager["Sijax"] = flask_sijax
	# FManager["SijaxSubmit"] = SubmitType
	FManager["SijaxStaticPath"] = FManager.main + 'static/js/sijax/'
	FManager["SijaxJsonUri"] = '/static/js/sijax/json2.js'

	# User, login related init
	FManager["FamcyUser"] = FUser
	FManager["LoginManager"] = LoginManager()
	FManager["CurrentUser"] = current_user

	# System Wide blueprints and application object
	MainBlueprint = Blueprint('MainBlueprint', __name__)
	globals()["MainBlueprint"] = MainBlueprint
	FManager["MainBlueprint"] = MainBlueprint
	FManager["CurrentApp"] = current_app

	# Webpage related configs
	FManager["ConsoleConfig"] = FManager.read(FManager.console + "/famcy.yaml")

	# ------------------------
	# --- Main app start zone
	# ------------------------
	app = Flask(__name__)
	# Now tell Flask to use the custom class
	app.json_encoder = CustomJSONEncoder
	# Some sort of security here -> TODO check on this
	app.config['SECRET_KEY'] = FManager.get_credentials("flask_secret_key", "").encode("utf-8")

	# Init Sijax
	FManager["Sijax"].Sijax().init_app(app)
	# FamcyWebSocket = WebSocket(app)
	# FamcyWebSocketLoopDelay = 2.5
	FamcyBackgroundQueue = FamcyPriorityQueue()
	globals()["FamcyBackgroundQueue"] = FamcyBackgroundQueue

	# Init http client
	FManager.init_http_client(**FManager["ConsoleConfig"])
	# Security Enhance
	FManager.register_csrf(app)

	store = RedisStore(redis.StrictRedis())
	globals()["store"] = store
	KVSessionExtension(store, app)

	# User Static Data
	@MainBlueprint.route('/asset/<path:filename>')
	def user_custom_asset(filename):
		# Usage in template {{ url_for('user_custom_asset', filename='doday_icon.png') }}
		return send_from_directory(FManager.console + "/" + FManager.USER_STATIC_FOLDER, filename)

	# Import Fblocks from default and custom folders. 
	# ------------------------------
	# Get all sources of felements definitions 
	system_styles = FManager.importclassdir(FManager.main + "/", "_elements_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_styles)

	# Get all sources of fblocks definitions 
	system_items = FManager.importclassdir(FManager.main + "/", "_items_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_items)

	# Get all sources of fresponse definitions 
	system_responses = FManager.importclassdir(FManager.main + "/", "_responses_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_responses)

	# Get all sources of fstyle definitions 
	system_styles = FManager.importclassdir(FManager.main + "/", "_style_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_styles)

	# Import module recursively for all pages in the console folder
	class_dir = FManager.importclassdir(FManager.console, "", FamcyFileImportMode.fixed, "page", recursive=True, 
			exclude=["_", "."], otherwise=None)

	# Register the main blueprint that is used in the FamcyPage
	app.register_blueprint(MainBlueprint)

	# Init Login Manager and Related Stuffs
	if FManager["ConsoleConfig"]["with_login"]:
		# Init login manager
		FManager["LoginManager"].login_view = "MainBlueprint.famcy_route_func_name_"+FManager["ConsoleConfig"]['login_url'].replace("/", "_")
		FManager["LoginManager"].init_app(app)
		FManager["FamcyUser"].setup_user_loader()
		assert Famcy.FamcyLoginManager, "User Must Register Famcy Login Manager"

	return app

	Main creation function of the famcy application. 
	Can set to different factory settings in the future. 
	
Main creation function of the famcy application.
Can set to different factory settings in the future.
Main creation function of the famcy application . Can set to different factory settings in the future .
def create_app(famcy_id, production=False):
	FManager = FamcyManager(famcy_id, famcy_dir, production=production)
	globals()["FManager"] = FManager
	FManager["CUSTOM_STATIC_PATH"] = FManager.console + "_static_"
	FManager["Sijax"] = flask_sijax
	FManager["SijaxStaticPath"] = FManager.main + 'static/js/sijax/'
	FManager["SijaxJsonUri"] = '/static/js/sijax/json2.js'
	FManager["FamcyUser"] = FUser
	FManager["LoginManager"] = LoginManager()
	FManager["CurrentUser"] = current_user
	MainBlueprint = Blueprint('MainBlueprint', __name__)
	globals()["MainBlueprint"] = MainBlueprint
	FManager["MainBlueprint"] = MainBlueprint
	FManager["CurrentApp"] = current_app
	FManager["ConsoleConfig"] = FManager.read(FManager.console + "/famcy.yaml")
	app = Flask(__name__)
	app.json_encoder = CustomJSONEncoder
	app.config['SECRET_KEY'] = FManager.get_credentials("flask_secret_key", "").encode("utf-8")
	FManager["Sijax"].Sijax().init_app(app)
	FamcyBackgroundQueue = FamcyPriorityQueue()
	globals()["FamcyBackgroundQueue"] = FamcyBackgroundQueue
	FManager.init_http_client(**FManager["ConsoleConfig"])
	FManager.register_csrf(app)
	store = RedisStore(redis.StrictRedis())
	globals()["store"] = store
	KVSessionExtension(store, app)
	@MainBlueprint.route('/asset/<path:filename>')
	def user_custom_asset(filename):
		return send_from_directory(FManager.console + "/" + FManager.USER_STATIC_FOLDER, filename)
	------
	system_styles = FManager.importclassdir(FManager.main + "/", "_elements_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_styles)
	system_items = FManager.importclassdir(FManager.main + "/", "_items_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_items)
	system_responses = FManager.importclassdir(FManager.main + "/", "_responses_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_responses)
	system_styles = FManager.importclassdir(FManager.main + "/", "_style_", FamcyFileImportMode.name, "", 
		exclude=["_", "."], otherwise=[], recursive=True)
	FManager.assign_to_global(globals(), system_styles)
	class_dir = FManager.importclassdir(FManager.console, "", FamcyFileImportMode.fixed, "page", recursive=True, 
			exclude=["_", "."], otherwise=None)
	app.register_blueprint(MainBlueprint)
	if FManager["ConsoleConfig"]["with_login"]:
		FManager["LoginManager"].login_view = "MainBlueprint.famcy_route_func_name_"+FManager["ConsoleConfig"]['login_url'].replace("/", "_")
		FManager["LoginManager"].init_app(app)
		FManager["FamcyUser"].setup_user_loader()
		assert Famcy.FamcyLoginManager, "User Must Register Famcy Login Manager"
	return app
def create_app ( famcy_id , production = False ) : FManager = FamcyManager ( famcy_id , famcy_dir , production = production ) globals ( ) [ "FManager" ] = FManager FManager [ "CUSTOM_STATIC_PATH" ] = FManager . console + "_static_" FManager [ "Sijax" ] = flask_sijax FManager [ "SijaxStaticPath" ] = FManager . main + 'static/js/sijax/' FManager [ "SijaxJsonUri" ] = '/static/js/sijax/json2.js' FManager [ "FamcyUser" ] = FUser FManager [ "LoginManager" ] = LoginManager ( ) FManager [ "CurrentUser" ] = current_user MainBlueprint = Blueprint ( 'MainBlueprint' , __name__ ) globals ( ) [ "MainBlueprint" ] = MainBlueprint FManager [ "MainBlueprint" ] = MainBlueprint FManager [ "CurrentApp" ] = current_app FManager [ "ConsoleConfig" ] = FManager . read ( FManager . console + "/famcy.yaml" ) app = Flask ( __name__ ) app . json_encoder = CustomJSONEncoder app . config [ 'SECRET_KEY' ] = FManager . get_credentials ( "flask_secret_key" , "" ) . encode ( "utf-8" ) FManager [ "Sijax" ] . Sijax ( ) . init_app ( app ) FamcyBackgroundQueue = FamcyPriorityQueue ( ) globals ( ) [ "FamcyBackgroundQueue" ] = FamcyBackgroundQueue FManager . init_http_client ( ** FManager [ "ConsoleConfig" ] ) FManager . register_csrf ( app ) store = RedisStore ( redis . StrictRedis ( ) ) globals ( ) [ "store" ] = store KVSessionExtension ( store , app ) @ MainBlueprint . route ( '/asset/<path:filename>' ) def user_custom_asset ( filename ) : return send_from_directory ( FManager . console + "/" + FManager . USER_STATIC_FOLDER , filename ) system_styles = FManager . importclassdir ( FManager . main + "/" , "_elements_" , FamcyFileImportMode . name , "" , exclude = [ "_" , "." ] , otherwise = [ ] , recursive = True ) FManager . assign_to_global ( globals ( ) , system_styles ) system_items = FManager . importclassdir ( FManager . main + "/" , "_items_" , FamcyFileImportMode . name , "" , exclude = [ "_" , "." ] , otherwise = [ ] , recursive = True ) FManager . assign_to_global ( globals ( ) , system_items ) system_responses = FManager . importclassdir ( FManager . main + "/" , "_responses_" , FamcyFileImportMode . name , "" , exclude = [ "_" , "." ] , otherwise = [ ] , recursive = True ) FManager . assign_to_global ( globals ( ) , system_responses ) system_styles = FManager . importclassdir ( FManager . main + "/" , "_style_" , FamcyFileImportMode . name , "" , exclude = [ "_" , "." ] , otherwise = [ ] , recursive = True ) FManager . assign_to_global ( globals ( ) , system_styles ) class_dir = FManager . importclassdir ( FManager . console , "" , FamcyFileImportMode . fixed , "page" , recursive = True , exclude = [ "_" , "." ] , otherwise = None ) app . register_blueprint ( MainBlueprint ) if FManager [ "ConsoleConfig" ] [ "with_login" ] : FManager [ "LoginManager" ] . login_view = "MainBlueprint.famcy_route_func_name_" + FManager [ "ConsoleConfig" ] [ 'login_url' ] . replace ( "/" , "_" ) FManager [ "LoginManager" ] . init_app ( app ) FManager [ "FamcyUser" ] . setup_user_loader ( ) assert Famcy . FamcyLoginManager , "User Must Register Famcy Login Manager" return app
Main creation function of the famcy application.
Main creation function of the famcy application .
"""
	Main creation function of the famcy application. 
	Can set to different factory settings in the future. 
	""" # Famcy Manager that manage all global vars, imports,  # file systems, http # globals()["SubmissionObjectTable"] = IdTable() # Header definitions # Sijax, submission related # FManager["SijaxSubmit"] = SubmitType # User, login related init # System Wide blueprints and application object # Webpage related configs # ------------------------ # --- Main app start zone # ------------------------ # Now tell Flask to use the custom class # Some sort of security here -> TODO check on this # Init Sijax # FamcyWebSocket = WebSocket(app) # FamcyWebSocketLoopDelay = 2.5 # Init http client # Security Enhance # User Static Data # Usage in template {{ url_for('user_custom_asset', filename='doday_icon.png') }} # Import Fblocks from default and custom folders.  # ------------------------------ # Get all sources of felements definitions  # Get all sources of fblocks definitions  # Get all sources of fresponse definitions  # Get all sources of fstyle definitions  # Import module recursively for all pages in the console folder # Register the main blueprint that is used in the FamcyPage # Init Login Manager and Related Stuffs # Init login manager
famcy_id
production