File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from pathlib import Path
2+
3+ from flask import Flask , abort , send_from_directory
4+
5+
6+ BASE_DIR = Path (__file__ ).resolve ().parent
7+
8+ app = Flask (__name__ , static_folder = None )
9+
10+
11+ @app .get ("/" )
12+ def index ():
13+ return send_from_directory (BASE_DIR , "index.html" )
14+
15+
16+ @app .get ("/<path:path>" )
17+ def serve_site_file (path ):
18+ target = (BASE_DIR / path ).resolve ()
19+ if not target .is_file () or BASE_DIR not in target .parents :
20+ abort (404 )
21+ return send_from_directory (BASE_DIR , path )
22+
Original file line number Diff line number Diff line change 1+ Flask == 3.0.3
Original file line number Diff line number Diff line change 1- {
2- "buildCommand" : null ,
3- "outputDirectory" : " ."
1+ {
2+ "version" : 2 ,
3+ "builds" : [
4+ {
5+ "src" : " app.py" ,
6+ "use" : " @vercel/python"
7+ }
8+ ],
9+ "routes" : [
10+ {
11+ "src" : " /(.*)" ,
12+ "dest" : " app.py"
13+ }
14+ ]
415}
You can’t perform that action at this time.
0 commit comments