forked from server/soundboard
Add WSGI deployment files for Apache
This commit is contained in:
parent
804891e1d0
commit
050be9d4f6
15
apache/010-soundboard.conf
Normal file
15
apache/010-soundboard.conf
Normal 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>
|
||||
@ -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
10
soundboard.wsgi
Normal 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
|
||||
Loading…
x
Reference in New Issue
Block a user