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.

25 lines
419 B
Python

import os
2 years ago
import prefix
2 years ago
from flask import Flask, render_template
from flask_sock import Sock
app = Flask(__name__, )
2 years ago
sock = Sock(app)
2 years ago
app.wsgi_app = prefix.PrefixMiddleware(
app.wsgi_app, prefix=os.environ.get("URL_PREFIX", "")
)
2 years ago
@app.route('/')
def index():
return render_template('index.html')
2 years ago
@sock.route('/echo/')
2 years ago
def echo(sock):
while True:
data = sock.receive()
sock.send(data)