forked from realpython/materials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
executable file
·43 lines (33 loc) · 1.34 KB
/
Copy path__init__.py
File metadata and controls
executable file
·43 lines (33 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
from flask import Flask
from flask import render_template
from flask_bootstrap import Bootstrap
from flask_sqlalchemy import SQLAlchemy
from config import Config
# Define the application
app = Flask(__name__, instance_relative_config=False)
# Configure the application
app.config.from_object(Config)
# Define the database object
db = SQLAlchemy(app)
# Initialize Bootstrap connection
Bootstrap(app)
# Register Blueprings
from .artists import routes as artist_routes # noqa: E402
from .albums import routes as album_routes # noqa: E402
from .tracks import routes as track_routes # noqa: E402
from .playlists import routes as playlist_routes # noqa: E402
from .customers import routes as customer_routes # noqa: E402
from .invoices import routes as invoice_routes # noqa: E402
from .employees import routes as employee_routes # noqa: E402
app.register_blueprint(artist_routes.artists_bp)
app.register_blueprint(album_routes.albums_bp)
app.register_blueprint(track_routes.tracks_bp)
app.register_blueprint(playlist_routes.playlists_bp)
app.register_blueprint(customer_routes.customers_bp)
app.register_blueprint(invoice_routes.invoices_bp)
app.register_blueprint(employee_routes.employees_bp)
# Sample HTTP error handling
@app.errorhandler(404)
def not_found(error):
return render_template("404.html"), 404
from app import models # noqa: F401, E402