text: import os
  
  from flask import Flask
  from flask_assets import Environment
  from flask_compress import Compress
  from flask_login import LoginManager
  from flask_mail import Mail
  from flask_rq import RQ
  from flask_sqlalchemy import SQLAlchemy
  from flask_wtf import CSRFProtect
  from flask_uploads import UploadSet, configure_uploads, IMAGES
  from flask_recaptcha import ReCaptcha
  from flask_ckeditor import CKEditor
  
  from app.assets import app_css, app_js, vendor_css, vendor_js
  from config import config as Config
  
  basedir = os.path.abspath(os.path.dirname(__file__))
  #curr = os.path.dirname(os.path.realpath(__file__))
  UPLOAD_FOLDER = 'C:/Users/oem/Documents/GitHub/landingpage_cms/app/static/'
  mail = Mail()
  db = SQLAlchemy()
  csrf = CSRFProtect()
  compress = Compress()
  images = UploadSet('images', IMAGES)
  docs = UploadSet('docs', ('rtf', 'odf', 'ods', 'gnumeric', 'abw', 'doc', 'docx', 'xls', 'xlsx', 'pdf'))
  
  # Set up Flask-Login
  login_manager = LoginManager()
  login_manager.session_protection = 'strong'
  login_manager.login_view = 'account.login'
  
  recaptcha = ReCaptcha()
  
  
  def create_app(config):
      app = Flask(__name__)
      config_name = config
  
      if not isinstance(config, str):
          config_name = os.getenv('FLASK_CONFIG', 'default')
  
      app.config.from_object(Config[config_name])
      app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
      app.config['MAX_CONTENT_LENGTH'] = 1024 * 1024
      app.config['UPLOAD_EXTENSIONS'] = ['.jpg', '.png', '.gif']
      # not using sqlalchemy event system, hence disabling it
  ##    app.config['UPLOADED_IMAGES_DEST'] = curr+'/../../app/static/photo/'
  ##    app.config['UPLOADED_DOCS_DEST'] = curr+'/../../app/static/docs/'
  ##    app.config['UPLOADED_PATH'] = curr+'/../../app/static/images/'
      app.config['UPLOADS_DEFAULT_DEST'] = UPLOAD_FOLDER
  
  
      Config[config_name].init_app(app)
  
      # Set up extensions
      mail.init_app(app)
      db.init_app(app)
      login_manager.init_app(app)
      csrf.init_app(app)
      compress.init_app(app)
      RQ(app)
      configure_uploads(app, (images))
      configure_uploads(app, docs)
      CKEditor(app)
  
      # Register Jinja template functions
      from .utils import register_template_utils
      register_template_utils(app)
  
      # Set up asset pipeline
      assets_env = Environment(app)
      dirs = ['assets/styles', 'assets/scripts']
      for path in dirs:
          assets_env.append_path(os.path.join(basedir, path))
      assets_env.url_expire = True
  
      assets_env.register('app_css', app_css)
      assets_env.register('app_js', app_js)
      assets_env.register('vendor_css', vendor_css)
      assets_env.register('vendor_js', vendor_js)
  
      # Configure SSL if platform supports it
      if not app.debug and not app.testing and not app.config['SSL_DISABLE']:
          from flask_sslify import SSLify
          SSLify(app)
  
      # Create app blueprints
  
  
      from .blueprints.main import main as main_blueprint
      app.register_blueprint(main_blueprint)
  
      from .blueprints.public import public as public_blueprint
      app.register_blueprint(public_blueprint)
  
      from .blueprints.account import account as account_blueprint
      app.register_blueprint(account_blueprint, url_prefix='/account')
  
      from .blueprints.admin import admin as admin_blueprint
      app.register_blueprint(admin_blueprint, url_prefix='/admin')
  
      return app
  