Spaces:
Sleeping
Sleeping
| 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 = '%]' | |
| def index(): | |
| return render_template('index.html') | |
| def healthz(): | |
| return "ok" | |
| def page_not_found(e): | |
| return "404 Not Found", 404 | |
| 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}") | |