Page 1 of 1

Using Dash

Posted: Thu 12 Apr 12 2018 1:17 pm
by Daniel Wee

Code: Select all

import dash
from dash.dependencies import Input, Output
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

# define the layout of the page
app.layout = html.Div([
	dcc.Input(id='input', value='Enter something here!', type='text'),

# define the callback function
# this decorator function replaces some called function and performs the actual value update
# the function to update the value must immediately follow this decorator
	# change element marked 'output' whenever element 'input' changes its 'value'
	Output(component_id='output', component_property='children'),
	[Input(component_id='input', component_property='value')]
def update_value(input_data):
	return 'Input: "{}"'.format(input_data)

if __name__ == "__main__":

Re: Using Dash

Posted: Sun 06 May 06 2018 12:58 am
by Daniel Wee
To configure apache2 to redirect an alias to a different port, use proxy functions:- ... internally ... untu-16-04

This somewhat works but seems to fail in loading the layout. May need more work on the code.

Trying to resolve "Layout not loading issue"

Posted: Sun 06 May 06 2018 1:25 am
by Daniel Wee

Re: Using Dash

Posted: Sun 06 May 06 2018 1:35 am
by Daniel Wee
Resolution involved:-

Setting up mod_wsgi to work:-

see files:-

See Proxy lines for port 80 and 443 (SSL)

See how to get apache2 to serve up dash on given port 8050

You'll need to enable this with:-

Code: Select all

sudo a2ensite attendance
sudo service apache2 reload
Also need to make sure apache2 is listening on the port. See:-

See intermediate launch file:-
*note especially the hash bang line at the start

See dash python file:-
* see line with app.config.requests_pathname_prefix = "" ... out/8139/5

Re: Using Dash

Posted: Mon 07 May 07 2018 1:02 am
by Daniel Wee

Re: Using Dash

Posted: Mon 04 Nov 04 2019 12:23 pm
by Daniel Wee
The points of concern are:-

- add Listen 8054 (or whichever port you will be using)

/etc/apache2/sites-available/app.conf (whatever your app happens to be)
- <VirtualHost: *:8054> (or whichever port you will be using)

- ProxyPass "/virtualdirectory/" "http://realurl:8054/" (where real url can be or wherever the app is being served from)
- ProxyPassReverse "/virtualdirectory/" "http://realurl:8054/"
- repeat this for the 443 segment below

check that /var/www/html/wsgi/app.wsgi is owned by www-data:www-data
- from appscript import server as application (here appscript is the actual python script - could be or similar)

sudo a2ensite app.conf (to enable the site)
sudo systemctl reload apache2

Re: Using Dash

Posted: Mon 04 Nov 04 2019 3:46 pm
by Daniel Wee
Places where the domain name clashes:-

- ServerName in the <VirtualHost *:80> section

- ServerName and ServerAlias in the <VirtualHost *:80> section