diff --git a/app/__init__.py b/app/__init__.py index e69de29..bee6b70 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -0,0 +1,20 @@ +from flask import Flask +from flask_sqlalchemy import SQLAlchemy +from flask_login import LoginManager + +db = SQLAlchemy() +login_manager = LoginManager() + +def create_app(): + app = Flask(__name__) + app.config['SECRET_KEY'] = 'devkey' # Change this for production + app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///do_tracker.db' + app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False + + db.init_app(app) + login_manager.init_app(app) + + from .routes import main as main_blueprint + app.register_blueprint(main_blueprint) + + return app diff --git a/app/routes.py b/app/routes.py index e69de29..111a3a7 100644 --- a/app/routes.py +++ b/app/routes.py @@ -0,0 +1,7 @@ +from flask import Blueprint + +main = Blueprint('main', __name__) + +@main.route("/") +def home(): + return "
Welcome to the system.
" diff --git a/run.py b/run.py index e69de29..488dae9 100644 --- a/run.py +++ b/run.py @@ -0,0 +1,6 @@ +from app import create_app + +app = create_app() + +if __name__ == "__main__": + app.run(debug=True)