You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.8 KiB
57 lines
1.8 KiB
from flask import Flask
|
|
from flask_session import Session
|
|
|
|
from flask_sqlalchemy import SQLAlchemy
|
|
from flask_bcrypt import Bcrypt
|
|
from flask_login import LoginManager
|
|
from flask_mail import Mail
|
|
from minibase.config import Config
|
|
|
|
# (DATABASE) Definition
|
|
db = SQLAlchemy()
|
|
# (PASSWORD) Hashign Program to save paswords safely
|
|
bcrypt = Bcrypt()
|
|
# (LOGIN) Login manage plugin configuration
|
|
login_manager = LoginManager()
|
|
login_manager.login_view = 'users.login'
|
|
login_manager.login_message_category = 'info' # Boostrap Info Message
|
|
# (EMAIL AGENT) Definition
|
|
mail = Mail()
|
|
session = Session()
|
|
|
|
|
|
def create_minibase(config_class=Config):
|
|
# (FLASK) Main Flask Application
|
|
app = Flask(__name__)
|
|
app.config.from_object(Config)
|
|
# (DATABASE) Initialisation
|
|
#db.metadata.clear()
|
|
db.init_app(app)
|
|
# (PASSWORD) Initialisation
|
|
bcrypt.init_app(app)
|
|
# (LOGIN) Initialisation
|
|
login_manager.init_app(app)
|
|
# (EMAIL AGENT) Initialisation
|
|
mail.init_app(app)
|
|
# Session for variable manipulation on server side
|
|
|
|
# (FLASK) Importing and then registering Blueprints (Wievs)
|
|
from minibase.users.routes import users
|
|
from minibase.posts.routes import posts
|
|
from minibase.main.routes import main
|
|
from minibase.company.routes import company
|
|
from minibase.admin.routes import admin
|
|
from minibase.person.routes import person
|
|
from minibase.project.routes import project
|
|
from minibase.errors.handlers import errors
|
|
app.register_blueprint(users)
|
|
app.register_blueprint(posts)
|
|
app.register_blueprint(main)
|
|
app.register_blueprint(company)
|
|
app.register_blueprint(admin)
|
|
app.register_blueprint(person)
|
|
app.register_blueprint(project)
|
|
app.register_blueprint(errors)
|
|
# Return The created app
|
|
return app
|