Ejemplo n.º 1
0
# -*- coding: utf-8 -*-

from flask import Flask
from flask_controller import FlaskControllerRegister
from flask_static_digest import FlaskStaticDigest

app = Flask(__name__)

# flask digest compile
FlaskStaticDigest(app)

# route rule
register = FlaskControllerRegister(app)
register.register_package('flask_webpack_app.controllers')
Ejemplo n.º 2
0
import os
import sys

from flask import Flask, render_template, flash, url_for, current_app, redirect
from flask_static_digest import FlaskStaticDigest
from werkzeug.middleware.proxy_fix import ProxyFix
from werkzeug.security import generate_password_hash, check_password_hash

from wearebeautiful.db_model import db, DB_FILE
import wearebeautiful.utils as utils
import config

STATIC_FOLDER = "../static"
TEMPLATE_FOLDER = "../template"

flask_static_digest = FlaskStaticDigest()

app = Flask(__name__,
            static_folder=STATIC_FOLDER,
            template_folder=TEMPLATE_FOLDER)
app.config.from_object('config')
app.config['FONTAWESOME_SERVE_LOCAL'] = False
app.config['FLASK_STATIC_DIGEST'] = flask_static_digest

app.wsgi_app = ProxyFix(app.wsgi_app)

flask_static_digest.init_app(app)

db_file = os.path.join(config.MODEL_DIR, DB_FILE)
if not os.path.exists(db_file):
    print("WARNING: Cannot find models db: %s" % db_file)
Ejemplo n.º 3
0
# -*- coding: utf-8 -*-

"""
recsys.extensions
~~~~~~~~~~~~~~~~~

Extensions module. Each extension is initialized in the app factory located in app.py.

:copyright: (c) 2020 by TzeSing.
:license: Apache2, see LICENSE for more details.
"""

from flask_caching import Cache
from flask_debugtoolbar import DebugToolbarExtension
from flask_login import LoginManager
from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy
from flask_static_digest import FlaskStaticDigest
from flask_wtf.csrf import CSRFProtect

csrf_protect = CSRFProtect()
login_manager = LoginManager()
db = SQLAlchemy()
migrate = Migrate()
cache = Cache()
debug_toolbar = DebugToolbarExtension()
flask_static_digest = FlaskStaticDigest()
Ejemplo n.º 4
0
from werkzeug.middleware.proxy_fix import ProxyFix
import pathlib
import os
import datetime
import sys

__version__ = '0.2.0'

logs = LogSetup()
db = SQLAlchemy()
migrate = Migrate()
login_mgr = LoginManager()
ldap_mgr = LDAP3LoginManager()
principal = Principal()
cache = Cache()
flask_statics = FlaskStaticDigest()
apifairy = APIFairy()
ma = Marshmallow()
csrf = CSRFProtect()
# celery = Celery(__name__)
# Breadcrumbs is a subclass of flask_menu.Menu
menu = Menu()


def create_app(config='newswriter.config.Config'):
    """Inicializar la aplicación"""
    if getattr(sys, 'frozen', False):
        # para pyinstaller
        instance_path = os.path.join(os.path.expanduser("~"), "newswriter")
        app = Flask(__name__, instance_path=instance_path)
        app.config['PYINSTALLER'] = True