from flask import Flask
from dotenv import load_dotenv

from project import  basededatos


import sqlite3

def create_app():
    app = Flask(__name__)
    app.config.from_prefixed_env()

   
    basededatos.init_app()

    # blueprint for auth routes in our app
    from .auth import auth as auth_blueprint
    app.register_blueprint(auth_blueprint)

    # blueprint for non-auth parts of app
    from .main import main as main_blueprint
    app.register_blueprint(main_blueprint)

    print(f"Current Environment: {os.getenv('ENVIRONMENT')}")
    print(f"Using Database: {app.config.get('DATABASE')}")


    return app