如何在给定的时间点将 dash 应用程序的访问限制为单个用户?
How to restrict the access of dash application to a single user at a given point in time?
我有一个破折号 python 网络应用程序,我想在给定的时间点将此应用程序的访问权限限制为单个用户。我怎样才能做到这一点?有没有办法在第二个用户尝试访问事件时获取事件?
我前段时间实现了类似的东西。
基本上,我根据时间条件更改了呈现的布局。
就我而言,我想让我的应用程序在工作时间内运行。 (从 08:00 到 19:00)。
@app.callback(Output("page-content", "children"), [Input("url", "pathname")])
def render_page_content(pathname):
# ---------------------------------------------------
if pathname == "/":
# define working time for MILF services
day_of_week = date.today().strftime("%A")
now = datetime.datetime.now()
working_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
if day_of_week in working_days and (now.hour >= 8) and (now.hour < 19):
# if working time is ok, render App page
layout = html.Div([tab01.layout])
else:
# if working time is closed, render an Info Page
layout = dcc.Markdown('''
### APP is not working now... See you soon !
###### Opening time : Monday - Friday
###### Opening hours : 08:00 - 19:00
'''),
return layout
当不满足条件时,我会打印消息:“应用程序现在无法运行...稍后见!”
我有一个破折号 python 网络应用程序,我想在给定的时间点将此应用程序的访问权限限制为单个用户。我怎样才能做到这一点?有没有办法在第二个用户尝试访问事件时获取事件?
我前段时间实现了类似的东西。 基本上,我根据时间条件更改了呈现的布局。 就我而言,我想让我的应用程序在工作时间内运行。 (从 08:00 到 19:00)。
@app.callback(Output("page-content", "children"), [Input("url", "pathname")])
def render_page_content(pathname):
# ---------------------------------------------------
if pathname == "/":
# define working time for MILF services
day_of_week = date.today().strftime("%A")
now = datetime.datetime.now()
working_days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']
if day_of_week in working_days and (now.hour >= 8) and (now.hour < 19):
# if working time is ok, render App page
layout = html.Div([tab01.layout])
else:
# if working time is closed, render an Info Page
layout = dcc.Markdown('''
### APP is not working now... See you soon !
###### Opening time : Monday - Friday
###### Opening hours : 08:00 - 19:00
'''),
return layout
当不满足条件时,我会打印消息:“应用程序现在无法运行...稍后见!”