示例#1
0
文件: run.py 项目: Janek3d/teleserver
from tools.secret_manager import SecretManager
from tools.calendar_generation import sendToGoogleCalendar, initializeCalendar, desk_available
import tools.system_calls as system
from IoT_master.tmp_tab import desk_reservations

sec = SecretManager()
VALID_USERNAME_PASSWORD_PAIRS = sec.get_credentials_for_GUI()

external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']

server = flask.Flask(__name__)
server.config['SECRET_KEY'] = sec.get_secret_key()
app = dash.Dash(__name__,
                server=server,
                external_stylesheets=external_stylesheets)
app.layout = gui_layout()
app.title = 'teleserver'
app.config['suppress_callback_exceptions'] = True
if VALID_USERNAME_PASSWORD_PAIRS != {}:
    auth = dash_auth.BasicAuth(app, VALID_USERNAME_PASSWORD_PAIRS)


def token_required(f):
    """This is a decorator to verify whether API user provided valid token
    Token is required to operate through API

    :param f: Function to decorate
    :type f: function
    """
    @wraps(f)
    def decorated(*args, **kwargs):
示例#2
0
 def test_gui_layout(self):
     self.assertIsInstance(type(gui_layout()),
                           dash.development.base_component.ComponentMeta)