Add WSGI deployment files for Apache

This commit is contained in:
Martin Müller 2017-07-17 11:46:58 +02:00
parent 804891e1d0
commit 050be9d4f6
3 changed files with 27 additions and 1 deletions

View File

@ -0,0 +1,15 @@
Listen 5000
<VirtualHost *:5000>
#ServerName example.com
WSGIDaemonProcess soundboard user=www-data group=www-data threads=5
WSGIScriptAlias / /var/www/soundboard/soundboard.wsgi
<Directory /var/www/soundboard>
WSGIProcessGroup soundboard
WSGIApplicationGroup %{GLOBAL}
WSGIScriptReloading On
Order deny,allow
Allow from all
</Directory>
</VirtualHost>

View File

@ -18,7 +18,8 @@ processlist = []
@app.route("/say/", methods=["POST"])
@app.route("/say/<text>")
def index(sound=None, text=None, video=None):
sounds = sorted(os.listdir(config.path))
sounds = [os.fsencode(file).decode() for file in os.listdir(config.path)]
sounds = sorted(sounds)
if sound is not None and sound in sounds:
subprocess.Popen(["omxplayer", os.path.join(config.path, sound)], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)

10
soundboard.wsgi Normal file
View File

@ -0,0 +1,10 @@
import sys
sys.path.insert(0, '/var/www/soundboard')
activate_this = '/var/www/soundboard/py/bin/activate_this.py'
with open(activate_this) as file_:
exec(file_.read(), dict(__file__=activate_this))
from soundboard import app as application