-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
30 lines (25 loc) · 975 Bytes
/
app.py
File metadata and controls
30 lines (25 loc) · 975 Bytes
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
from bottle import Bottle
from config import Config
class App:
"""Classe principal da aplicação que configura e executa o servidor Bottle."""
def __init__(self):
"""Inicializa a aplicação Bottle e carrega as configurações."""
self.bottle = Bottle()
self.config = Config()
def setup_routes(self):
"""Configura as rotas da aplicação importando e inicializando os controladores."""
from controllers import init_controllers
print('🚀 Inicializa rotas!')
init_controllers(self.bottle)
def run(self):
"""Inicia o servidor Bottle com as configurações definidas."""
self.setup_routes()
self.bottle.run(
host=self.config.HOST,
port=self.config.PORT,
debug=self.config.DEBUG,
reloader=self.config.RELOADER
)
def create_app():
"""Função de fábrica para criar uma instância da aplicação."""
return App()