forgot frontend
This commit is contained in:
parent
4b708ba090
commit
2907cd30b4
1 changed files with 15 additions and 17 deletions
32
main.py
32
main.py
|
|
@ -7,10 +7,9 @@ import hashlib
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
import csv
|
import csv
|
||||||
import re
|
import re
|
||||||
from flask import Flask, send_file
|
from flask import Flask, send_file, send_from_directory, abort
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
ZIP_URL = "https://docs.google.com/spreadsheets/d/1S6WwM05O277npQbaiNk-jZlXK3TdooSyWtqaWUvAI78/export?format=zip"
|
ZIP_URL = "https://docs.google.com/spreadsheets/d/1S6WwM05O277npQbaiNk-jZlXK3TdooSyWtqaWUvAI78/export?format=zip"
|
||||||
|
|
@ -258,23 +257,22 @@ def serve_artists_csv():
|
||||||
def serve_artists_xlsx():
|
def serve_artists_xlsx():
|
||||||
return send_file(XLSX_FILENAME, mimetype="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
return send_file(XLSX_FILENAME, mimetype="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")
|
||||||
|
|
||||||
|
# Serve index.html at "/", "/index", and "/index.html"
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
@app.route("/index.html/")
|
@app.route("/index")
|
||||||
|
@app.route("/index.html")
|
||||||
def serve_index():
|
def serve_index():
|
||||||
# Simple index page linking to your files
|
return send_file("templates/index.html", mimetype="text/html")
|
||||||
return """
|
|
||||||
<html>
|
# Serve static files from templates/_next/ as /_next/...
|
||||||
<head><title>Artists Data</title></head>
|
@app.route("/_next/<path:filename>")
|
||||||
<body>
|
def serve_next_static(filename):
|
||||||
<h1>Artists Data</h1>
|
return send_from_directory("templates/_next", filename)
|
||||||
<ul>
|
|
||||||
<li><a href="/artists.html">Artists.html</a></li>
|
# Custom 404 error page
|
||||||
<li><a href="/artists.csv">artists.csv</a></li>
|
@app.errorhandler(404)
|
||||||
<li><a href="/artists.xlsx">artists.xlsx</a></li>
|
def page_not_found(e):
|
||||||
</ul>
|
return send_file("templates/404.html", mimetype="text/html"), 404
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
"""
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
threading.Thread(target=update_loop, daemon=True).start()
|
threading.Thread(target=update_loop, daemon=True).start()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue