mirror of
https://github.com/pds-nest/nest.git
synced 2024-11-22 04:54:18 +00:00
Even better backend structure
This commit is contained in:
parent
9a55ea049e
commit
ee3f696aef
5 changed files with 23 additions and 5 deletions
|
@ -1,8 +1,8 @@
|
|||
from flask import Flask
|
||||
import os
|
||||
import werkzeug.middleware.proxy_fix
|
||||
from .routes import doa
|
||||
from .database.base import Base
|
||||
from .routes import *
|
||||
from .database import Base
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
|
@ -14,7 +14,7 @@ reverse_proxy_app = werkzeug.middleware.proxy_fix.ProxyFix(app=app, x_for=1, x_p
|
|||
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://postgres:password@localhost:5432/PdSDev'
|
||||
|
||||
# Routes setup
|
||||
app.add_url_rule("/doa", view_func=doa.page, methods=["GET"])
|
||||
app.add_url_rule("/doa", view_func=page_doa, methods=["GET"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
|
|
6
code/backend/nest_backend/database/__init__.py
Normal file
6
code/backend/nest_backend/database/__init__.py
Normal file
|
@ -0,0 +1,6 @@
|
|||
from .tables import *
|
||||
from .base import Base
|
||||
|
||||
"""
|
||||
This module imports all the tables and the declarative base
|
||||
"""
|
5
code/backend/nest_backend/database/tables/__init__.py
Normal file
5
code/backend/nest_backend/database/tables/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from .Utente import Utente
|
||||
|
||||
"""
|
||||
This module contains all database classes.
|
||||
"""
|
5
code/backend/nest_backend/routes/__init__.py
Normal file
5
code/backend/nest_backend/routes/__init__.py
Normal file
|
@ -0,0 +1,5 @@
|
|||
from .doa import page_doa
|
||||
|
||||
"""
|
||||
This module imports all the routes that return something to the frontend.
|
||||
"""
|
|
@ -1,9 +1,11 @@
|
|||
from flask import render_template, abort
|
||||
from ..database.tables.Utente import Utente
|
||||
from ..database import *
|
||||
|
||||
"""
|
||||
Page that displays a message if the server is on
|
||||
"""
|
||||
|
||||
def page():
|
||||
|
||||
def page_doa():
|
||||
utente = Utente()
|
||||
return "If you see this, the server is fine."
|
||||
|
|
Loading…
Reference in a new issue