-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
executable file
·42 lines (31 loc) · 1.05 KB
/
Copy pathapp.py
File metadata and controls
executable file
·42 lines (31 loc) · 1.05 KB
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
42
import os
import sys
from typing import Any
try:
from flask import Flask, send_from_directory
except ImportError:
print(
"Flask is not installed in this environment.\n"
"Install dependencies with: pip install -r requirements.txt",
file=sys.stderr,
)
raise
from Projects.pdf2jpg import register_pdf_routes
def create_app() -> Any:
app = Flask(__name__, static_folder="static", template_folder="templates")
app.config.setdefault("MAX_CONTENT_LENGTH", 100 * 1024 * 1024) # 100 MB
app.secret_key = os.environ.get("FLASK_SECRET", "dev-secret")
register_pdf_routes(app)
@app.route("/")
def index():
return send_from_directory("static/html", "index.html")
@app.route("/projects")
def projects():
return send_from_directory("static/html", "projects.html")
@app.route("/contact")
def contact():
return send_from_directory("static/html", "contact.html")
return app
if __name__ == "__main__":
app = create_app()
app.run(debug=True, host="0.0.0.0", port=5000)