Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Simple cgi programing

$
0
0

@rioredstone wrote:

I’m new here.

now I’m trying to make my dash app work on http server as cgi.

I made a simple cgi script as a portal.

#!/usr/local/bin/python3
import cgitb
cgitb.enable()

from wsgiref.handlers import CGIHandler
from myapp import server

CGIHandler().run(server)

when myapp is a flask app, the app “myapp.py” works.

from flask import Flask
server = Flask(__name__)

@server.route('/')
def hello_world():
    return "Hello World!"

if __name__ == '__main__':
    server.run()

but, when myapp is dash app, it don’t work.

#!/usr/local/bin/python3
# -*- cording: utf-8 -*-

import dash
import dash_core_components
import dash_html_components

app = dash.Dash(__name__)
server = app.server
app.config.suppress_callback_exceptions = True
app.config.update(
	{
		'routes_pathname_prefix': '',
		'requests_pathname_prefix': ''
	}
)

app.layout = dash_html_components.Div(
	[
		dash_html_components.H1("Hellow Dash World")
	]
)

if __name__ == '__main__':
    app.run_server()

it shows only “Loading…”, and has error “Can’t find variable: DashRenderer”.
the error show missing resource files like “http://192.168.0.58/cgi/_dash-component-suites/dash_html_components/dash_html_components.v1_0_2m1575101122.min.js

how can I fix this issue??

thanks.

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images