Merge branch 'main' of https://github.com/ArtistGrid/sheets
This commit is contained in:
commit
d78816b0df
1 changed files with 4 additions and 3 deletions
7
main.py
7
main.py
|
|
@ -8,6 +8,7 @@ import re
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from flask import Flask, send_file, render_template
|
from flask import Flask, send_file, render_template
|
||||||
from flask_cors import CORS # ✅ NEW IMPORT
|
from flask_cors import CORS # ✅ NEW IMPORT
|
||||||
|
from flask import send_from_directory
|
||||||
|
|
||||||
app = Flask(__name__, template_folder="templates")
|
app = Flask(__name__, template_folder="templates")
|
||||||
CORS(app) # ✅ ENABLE CORS FOR ALL ROUTES
|
CORS(app) # ✅ ENABLE CORS FOR ALL ROUTES
|
||||||
|
|
@ -135,13 +136,13 @@ def serve_csv():
|
||||||
|
|
||||||
@app.route("/<path:path>")
|
@app.route("/<path:path>")
|
||||||
def catch_all(path):
|
def catch_all(path):
|
||||||
if path.startswith("_next/") or path.startswith("templates/_next/"):
|
|
||||||
# Let frontend handle it (or you can serve static files here if needed)
|
|
||||||
return "", 404 # Or use `send_from_directory()` if serving files
|
|
||||||
if os.path.exists(CSV_FILE):
|
if os.path.exists(CSV_FILE):
|
||||||
return send_file(CSV_FILE, mimetype="text/csv", as_attachment=False)
|
return send_file(CSV_FILE, mimetype="text/csv", as_attachment=False)
|
||||||
return "CSV not ready yet.", 503
|
return "CSV not ready yet.", 503
|
||||||
|
|
||||||
|
@app.route('/_next/<path:filename>')
|
||||||
|
def serve_next(filename):
|
||||||
|
return send_from_directory(os.path.join(app.template_folder, '_next'), filename)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
thread = threading.Thread(target=background_updater, daemon=True)
|
thread = threading.Thread(target=background_updater, daemon=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue