Spaces:
Sleeping
Sleeping
File size: 1,057 Bytes
224e9b3 |
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 35 36 37 38 39 40 41 |
from flask import Flask, render_template, request, jsonify, send_from_directory
import os
import json
from datetime import datetime
app = Flask(__name__)
# Configure Jinja2 to use [[ ]] to avoid conflict with Vue
class CustomFlask(Flask):
jinja_options = Flask.jinja_options.copy()
jinja_options.update(dict(
variable_start_string='[[',
variable_end_string=']]',
))
app = CustomFlask(__name__)
# Ensure storage directory exists
STORAGE_DIR = "storage"
if not os.path.exists(STORAGE_DIR):
os.makedirs(STORAGE_DIR)
PROJECT_INFO = {
"name": "interactive-map-studio",
"title_cn": "交互式地图工坊",
"short_description": "为图片添加交互式热点,制作可点击的楼层指引、游戏地图或产品展示图。",
"version": "1.0.0"
}
@app.route('/')
def index():
return render_template('index.html', project=PROJECT_INFO)
@app.route('/health')
def health():
return "OK"
if __name__ == '__main__':
port = int(os.environ.get('PORT', 7860))
app.run(host='0.0.0.0', port=port)
|