File size: 802 Bytes
0318648
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9ce39b3
 
 
 
 
 
 
 
0318648
9ce39b3
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import os
from flask import Flask, render_template

app = Flask(__name__)

# Jinja2 configuration to avoid conflict with Vue
app.jinja_env.variable_start_string = '[['
app.jinja_env.variable_end_string = ']]'
app.jinja_env.block_start_string = '[%'
app.jinja_env.block_end_string = '%]'

@app.route('/')
def index():
    return render_template('index.html')

@app.route('/healthz')
def healthz():
    return "ok"

@app.errorhandler(404)
def page_not_found(e):
    return "404 Not Found", 404

@app.errorhandler(500)
def internal_server_error(e):
    return f"500 Internal Server Error: {str(e)}", 500

if __name__ == '__main__':
    try:
        port = int(os.environ.get('PORT', 7860))
        app.run(host='0.0.0.0', port=port)
    except Exception as e:
        print(f"Error starting server: {e}")