from app import create_app
app = create_app()
if __name__ == "__main__":
app.run(debug=True)
run.py
from flask import Flask
from app.blueprints.home import home_bp
from app.blueprints.admin import admin_bp
def create_app():
app = Flask(__name__)
app.register_blueprint(home_bp)
app.register_blueprint(admin_bp)
return app
__init__.py
from flask import Blueprint, render_template
home_bp = Blueprint("home", __name__)
@home_bp.route("/")
def home():
return render_template("home.html")
home.py
from flask import Blueprint
admin_bp = Blueprint("admin", __name__, url_prefix="/admin")
@admin_bp.route("/")
def admin_home():
return "Admin Page"
admin.py
<!DOCTYPE html>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>Home Page</h1>
<p>Blueprint 연습 성공!</p>
</body>
</html>
home.html