added rest-API, sqlalchemy and nice structure
This commit is contained in:
30
serve_frontend.py
Normal file
30
serve_frontend.py
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
from flask import render_template, send_from_directory, Blueprint
|
||||
|
||||
fe_path = os.path.join(os.getcwd(), "frontend", "dist")
|
||||
fe_bp = Blueprint('frontend', __name__, url_prefix='/', template_folder=os.path.join(fe_path, ""))
|
||||
|
||||
|
||||
@fe_bp.route('/js/<path:path>')
|
||||
def send_js(path):
|
||||
return send_from_directory(os.path.join(fe_path, "js"), path)
|
||||
|
||||
|
||||
@fe_bp.route('/css/<path:path>')
|
||||
def send_css(path):
|
||||
return send_from_directory(os.path.join(fe_path, "css"), path)
|
||||
|
||||
|
||||
@fe_bp.route('/img/<path:path>')
|
||||
def send_img(path):
|
||||
return send_from_directory(os.path.join(fe_path, "img"), path)
|
||||
|
||||
|
||||
@fe_bp.route('/', defaults={'path': ''})
|
||||
@fe_bp.route('/<path:path>')
|
||||
def catch_all(path):
|
||||
return render_template("index.html")
|
||||
Reference in New Issue
Block a user