You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
417 B
Python
24 lines
417 B
Python
import os
|
|
import prefix
|
|
from flask import Flask, render_template
|
|
from flask_sock import Sock
|
|
|
|
app = Flask(__name__, )
|
|
sock = Sock(app)
|
|
|
|
|
|
app.wsgi_app = prefix.PrefixMiddleware(
|
|
app.wsgi_app, prefix=os.environ.get("URL_PREFIX", "")
|
|
)
|
|
|
|
|
|
@app.route('/')
|
|
def index():
|
|
return render_template('index.html')
|
|
|
|
|
|
@sock.route('/echo')
|
|
def echo(sock):
|
|
while True:
|
|
data = sock.receive()
|
|
sock.send(data) |