diff options
Diffstat (limited to 'app')
-rw-r--r-- | app/__init__.py | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/app/__init__.py b/app/__init__.py new file mode 100644 index 0000000..3d1bac6 --- /dev/null +++ b/app/__init__.py @@ -0,0 +1,40 @@ +# -*- mode: python; -*- + +from flask import Flask +from flask_sqlalchemy import SQLAlchemy +from flask_login import LoginManager + + +db = SQLAlchemy() + + +def create_app(): + app = Flask(__name__) + app.config.from_pyfile("../config.py") + + db.init_app(app) + + login_manager = LoginManager() + login_manager.login_view = "auth.login" + login_manager.init_app(app) + + from .models import User + + @login_manager.user_loader + def load_user(user_id): + return User.query.get(int(user_id)) + + from .main import main + + app.register_blueprint(main) + + from .modules import common, auth, products, customers, ferti, invoices + + app.register_blueprint(common) + app.register_blueprint(auth) + app.register_blueprint(products) + app.register_blueprint(customers) + app.register_blueprint(ferti) + app.register_blueprint(invoices) + + return app |