How can I run Dash from the standard apache server available (in my case) on the raspberry pi.
I followed the instructions for installing flask, which looks like about the same approach.
So I have mod_wsgi installed:
pi@rpizolder ~/bin $ cat /etc/apache2/sites-available/dash.conf
WSGIDaemonProcess showtemperature user=pi group=pi home=/home/pi threads=5
WSGIScriptAlias /showtemperature /var/www/html/wsgi/showtemperature.wsgi
<Directory /home/pi/bin>
WSGIProcessGroup showtemperature
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Require all granted
</Directory>
pi@rpizolder ~/bin $
created a wsgi file:
pi@rpizolder ~/bin $ cat /var/www/html/wsgi/showtemperature.wsgi
#!/usr/bin/python
import sys
sys.path.insert(0,"/home/pi/bin/")
from showtemperature import app as application
pi@rpizolder ~/bin $
and took the first demo app:
pi@rpizolder ~/bin $ cat showtemperature.py
# -*- coding: utf-8 -*-
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div(children=[
html.H1(children='Hello Dash'),
html.Div(children='''
Dash: A web application framework for Python.
'''),
dcc.Graph(
id='example-graph',
figure={
'data': [
{'x': [1, 2, 3], 'y': [4, 1, 2], 'type': 'bar', 'name': 'SF'},
{'x': [1, 2, 3], 'y': [2, 4, 5], 'type': 'bar', 'name': u'Montréal'},
],
'layout': {
'title': 'Dash Data Visualization'
}
}
)
])
if __name__ == '__main__':
app.run_server(debug=True)
pi@rpizolder ~/bin $
Unfortunately when accessing the url, the server log shows an error that the .plotly folder is inaccessible, although in the configuration the proper user was defined (pi):
pi@rpizolder ~/bin $ tail -f /var/log/apache2/error.log
[Sat Jul 08 22:18:00.158000 2017] [wsgi:error] [pid 21930]
[Sat Jul 08 22:18:09.130181 2017] [wsgi:error] [pid 21930] [client 192.168.2.57:54791] mod_wsgi (pid=21930): Exception occurred processing WSGI script '/var/www/html/wsgi/showtemperature.wsgi'.
[Sat Jul 08 22:18:09.130685 2017] [wsgi:error] [pid 21930] [client 192.168.2.57:54791] TypeError: 'Dash' object is not callable
[Sat Jul 08 22:18:25.951932 2017] [wsgi:error] [pid 21934] /usr/local/lib/python2.7/dist-packages/plotly/tools.py:103: UserWarning:
[Sat Jul 08 22:18:25.952354 2017] [wsgi:error] [pid 21934]
[Sat Jul 08 22:18:25.952500 2017] [wsgi:error] [pid 21934] Looks like you don't have 'read-write' permission to your 'home' ('~') directory or to our '~/.plotly' directory. That means plotly's python api can't setup local configuration files. No problem though! You'll just have to sign-in using 'plotly.plotly.sign_in()'. For help with that: 'help(plotly.plotly.sign_in)'.
[Sat Jul 08 22:18:25.952646 2017] [wsgi:error] [pid 21934] Questions? Visit https://support.plot.ly
[Sat Jul 08 22:18:25.952770 2017] [wsgi:error] [pid 21934]
[Sat Jul 08 22:18:34.901116 2017] [wsgi:error] [pid 21934] [client 192.168.2.57:54802] mod_wsgi (pid=21934): Exception occurred processing WSGI script '/var/www/html/wsgi/showtemperature.wsgi'.
[Sat Jul 08 22:18:34.901541 2017] [wsgi:error] [pid 21934] [client 192.168.2.57:54802] TypeError: 'Dash' object is not callable
Maybe I overlook something, any help?
thanks,
Gerrit.