gpt4 book ai didi

python - CentOS Apache服务器无法正确部署Dash 1.4.0,网页一直处于上传状态,为什么?

转载 作者:太空宇宙 更新时间:2023-11-03 17:20:23 25 4
gpt4 key购买 nike

我使用 Dash 1.4.0 和 Flask 1.0.2 创建了以下小应用程序,请在下面找到它。我能够将它部署到 Centos Apache 服务器,它启动了,但我得到的唯一东西是一个加载页面,在浏览器控制台中我看到一些组件不存在,请看打印屏幕(我在图片中删除了我服务器的 ip),我应该怎么做才能解决这个问题?它在我的电脑上运行没有问题

Chrome 浏览器中的控制台: enter image description here

网络应用程序代码:

from libs.initsetup import InitSetup
import libs.dbops as dbops
import os
import dash
import dash_core_components as dcc
import dash_html_components as html
from flask_caching import Cache
from flask import Flask

on_server = True

if not on_server:
WORKDIR = ""
else:
WORKDIR = "/var/www/mosregwebsite_dash_plot"


external_stylesheets = ['https://codepen.io/chriddyp/pen/bWLwgP.css']
server = Flask(__name__)

dash_app = dash.Dash(__name__, server=server)

dash_app.scripts.config.serve_locally = True
dash_app.css.config.serve_locally = True

cache = Cache(dash_app.server, config={
'CACHE_TYPE': 'filesystem',
'CACHE_DIR': WORKDIR + os.path.join(os.getcwd(), 'cache-directory')
})

TIMEOUT = 1800 # plots are updated every 30 minutes


@cache.memoize(timeout=TIMEOUT)
def return_layout():
clients = InitSetup.read_initfile_json(WORKDIR + os.path.join(os.getcwd(), "jsons", "clients.json"))
HOST, DBUSER, DBPASSWORD, AUTH_PLUGIN, *rest = InitSetup.read_mysql_init_config_file(WORKDIR +
os.path.join(os.getcwd(), "mosregwebsite_dash_plot.config.txt"))

conn, curs = dbops.create_mysql_connection(HOST, DBUSER, DBPASSWORD, AUTH_PLUGIN)

graphs = []
for k, v in clients.items():
x, y = dbops.select_data_for_pictures(curs, k)
graphs.append({'x': x, 'y': y, 'type': 'lineplot', 'name': v})

return html.Div(children=[
dcc.Graph(
style={
'textAlign': 'center',
'height': '900px',
},
id='example-graph',
figure={
'data': graphs,
'layout': {
}

}
)
])


dash_app.layout = return_layout

if __name__ == '__main__':
os.mkdir("numbeo")
if not on_server:
dash_app.run_server(host='127.0.0.107', port=8999, debug=False)
else:
HOST, PORT = InitSetup.read_website_settings_from_config_file(
WORKDIR + os.path.join(os.getcwd(),
"mosregwebsite_dash_plot.config.txt"))
dash_app.run_server(host=HOST, port=int(PORT), debug=False)



######### WSGI FILE: ##################

import sys
import os
activate_this = '/var/www/mosregwebsite_dash_plot/env/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
sys.path.insert(0, '/var/www/mosregwebsite_dash_plot/')


from mosregwebsite_dash_plot import server as application

####### SETUP.PY ##############


from setuptools import setup


setup(
name='mosreg_webscrap_website',
version='1.0.0',
packages=[''],
url='',
license='',
author='kozyrev.av',
author_email='kozirev8@gmail.com',
description='This is website which display processed information from
mosreg website',
install_requires=[
'dash==1.4.0',
'Flask-Caching==1.7.2',
'mysql-connector==2.2.9',
'mysql-connector-python==8.0.16',
'flask==1.0.2'
]
)

最佳答案

https://dash.plot.ly/react-for-python-developers检查一切是否正确安装。

To install Node.js, go to the Node.js website to download the latest version. We recommend installing the LTS version.
Node.js will automatically install the Node Package Manager npm on your machine
Verify that node is installed by running: node -v
Verify that npm is installed by running: npm -v

关于python - CentOS Apache服务器无法正确部署Dash 1.4.0,网页一直处于上传状态,为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58343593/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com