✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
🐇 Announcing Dash VTK for 3d simulation graphics. Check out the March webinar.

Simple cgi programing

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.

I tried this and dash code works.

thank you for your reply, @russellthehippo !!

Did you try it on terminal or console, means not access to http://192.168***/index.cgi??

Did you ever get this fixed?
I did not see your question and went way overboard describing the exact same problem
https://community.plotly.com/t/dash-loading-failure-in-apache-cgi/37013. No one has offered an answer yet.
Setting url_base_pathname should fix it, but does not help me.
It seems that dash engineers and users are all using WSGI, but I’m stuck with Apache CGI and I presume you are also.