| commit | author | age | ||
| 4efab6 | 1 | # https://tecadmin.net/install-apache-mod-wsgi-on-ubuntu-16-04-xenial |
| B | 2 | # Include in /etc/apache2/conf-available/mod-wsgi.conf : |
| 3 | # WSGIScriptAlias /isttok /var/www/html/wsgi_isttok_status.py | |
| 4 | # and | |
| 5 | # systemctl restart apache2 | |
| 6 | # | |
| 7 | #import epics | |
| 8 | from epics import caget, caput, cainfo | |
| 9 | import os | |
| 10 | ||
| 11 | os.environ['EPICS_CA_ADDR_LIST'] = 'localhost 192.168.1.110' | |
| 12 | os.environ['EPICS_CA_AUTO_ADDR_LIST'] = 'NO' | |
| 13 | ||
| 14 | def application(environ,start_response): | |
| 15 | status = '200 OK' | |
| 16 | RPump1press = caget('ISTTOK:central:RPump1-Pressure') | |
| 17 | RPump2press = caget('ISTTOK:central:RPump2-Pressure') | |
| 18 | TMPump1press = caget('ISTTOK:central:TMPump1-PressureAdmission') | |
| 19 | VVesselpress = caget('ISTTOK:central:VVessel-Pressure') | |
| 20 | rpiCurrentTime = caget('ISTTOK:central:CurrentTime', as_string=True) | |
| 21 | opState = caget('ISTTOK:central:OPSTATE.VAL', as_string=True) | |
| 22 | pulseNum = caget('ISTTOK:central:PULSE-NUMBER') | |
| 23 | html = '<html>\n' \ | |
| 24 | '<body>\n' \ | |
| 25 | ' <h1> ISTTOK Present Condition </h1> \n' | |
| 26 | html += '<p>RPump1-Pressure: ' + str(RPump1press) + ' mBar </p>' | |
| 27 | html += '<p>RPump2-Pressure: ' + str(RPump2press) + ' mBar </p>' | |
| 28 | html += '<p>TMPump1-PressureAdmission: ' + str(TMPump1press) + ' mBar </p>' | |
| 29 | html += '<p>VVessel-Pressure: ' + str(VVesselpress) + ' mBar </p>' | |
| 30 | html += '<p>OPSTATE: ' + opState + ' </p>' | |
| 31 | html += '<p>PULSE-NUMBER: ' + str(pulseNum) + ' </p>' | |
| 32 | html += '<p>Rpi CurrentTime: ' + rpiCurrentTime + ' </p>' | |
| 33 | html += '</body>\n' \ | |
| 34 | '</html>\n' | |
| 35 | response_header = [('Content-type','text/html')] | |
| 36 | start_response(status,response_header) | |
| 37 | html = bytes(html, encoding= 'utf-8') | |
| 38 | return [html] | |