# Simple cgi programing

**URL:** <https://community.plotly.com/t/simple-cgi-programing/32336>\
**Category:** Dash Python\
**Created:** [December 9, 2019, 10:20am UTC](https://community.plotly.com/t/simple-cgi-programing/32336 "2019-12-09T10:20:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![rioredstone](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/rioredstone/32/8711_2.png) [@rioredstone](https://community.plotly.com/u/rioredstone)\
**Post date:** [December 9, 2019, 10:20am UTC](https://community.plotly.com/t/simple-cgi-programing/32336/1 "2019-12-09T10:20:30Z")

</div>

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.

```auto
#!/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.

```auto
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.

```auto
#!/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](http://192.168.0.58/cgi/_dash-component-suites/dash_html_components/dash_html_components.v1_0_2m1575101122.min.js)”

 ![Screenshot 2019-12-09 22.18.06](https://us1.discourse-cdn.com/flex024/uploads/plot/original/2X/b/b6142f3edd0c0f472ab245e76022644cfe601819.png)

how can I fix this issue??

thanks.

---

<div class="post-metadata">

**Author:** ![russellthehippo](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/russellthehippo/32/25312_2.png) [@russellthehippo](https://community.plotly.com/u/russellthehippo)\
**Post date:** [December 9, 2019, 3:05pm UTC](https://community.plotly.com/t/simple-cgi-programing/32336/2 "2019-12-09T15:05:11Z")

</div>

> [@rioredstone](#):
>
> ```auto
> 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()
> 
> ```

I tried this and dash code works.

---

<div class="post-metadata">

**Author:** ![rioredstone](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/rioredstone/32/8711_2.png) [@rioredstone](https://community.plotly.com/u/rioredstone)\
**Post date:** [December 10, 2019, 12:26am UTC](https://community.plotly.com/t/simple-cgi-programing/32336/3 "2019-12-10T00:26:47Z")

</div>

thank you for your reply, @russellthehippo !!

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

---

<div class="post-metadata">

**Author:** ![dr\_glenn](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/dr_glenn/32/9757_2.png) [@dr\_glenn](https://community.plotly.com/u/dr_glenn)\
**Post date:** [April 3, 2020, 10:34pm UTC](https://community.plotly.com/t/simple-cgi-programing/32336/4 "2020-04-03T22:34:56Z")

</div>

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](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.
