Spaces:
Sleeping
Sleeping
| from flask import Flask, render_template, send_from_directory | |
| import os | |
| app = Flask(__name__, static_folder='static') | |
| def index(): | |
| return render_template('index.html') | |
| def page_not_found(e): | |
| return render_template('index.html'), 404 | |
| def internal_server_error(e): | |
| return "Internal Server Error: " + str(e), 500 | |
| # Explicitly serve static files if needed (usually handled by Flask automatically, | |
| # but good for explicit control in some environments) | |
| def send_static(path): | |
| return send_from_directory('static', path) | |
| if __name__ == '__main__': | |
| port = int(os.environ.get('PORT', 7860)) | |
| app.run(debug=True, host='0.0.0.0', port=port) | |