Development
This commit is contained in:
parent
33ec9e7f1c
commit
0cec7d69c9
12 changed files with 124 additions and 92 deletions
|
|
@ -1,14 +1,15 @@
|
|||
import os, json, sys, importlib.util as _importlib_util
|
||||
from flask import Flask, Blueprint, session, redirect, get_flashed_messages
|
||||
from flask import Flask, Blueprint, session, redirect, get_flashed_messages, send_from_directory
|
||||
from markupsafe import Markup
|
||||
from config_utils import (
|
||||
ACCOUNTS_FILE, APP_DIR, CONFIGS_DIR, HEALTH_FILE,
|
||||
ACCOUNTS_FILE, APP_DIR, CONFIGS_DIR, HEALTH_FILE, WWW_DIR,
|
||||
load_config, queue_command, _find_cmd_in_queues,
|
||||
)
|
||||
from factory import (
|
||||
LEVEL_RANK, PAGES_DIR, e, client_level, passes, build_items,
|
||||
load_json, render_layout,
|
||||
)
|
||||
import settings as settings
|
||||
from pages.actions.action import bp as actions_bp
|
||||
from pages.bannedips.action import bp as bannedips_bp
|
||||
from pages.ddns.action import bp as ddns_bp
|
||||
|
|
@ -35,6 +36,16 @@ from api_apply_health import bp as api_apply_health_bp
|
|||
app = Flask(__name__)
|
||||
app.secret_key = os.environ.get('SECRET_KEY', os.urandom(24))
|
||||
|
||||
# Static www/ serving =================================================
|
||||
|
||||
@app.route('/www/<path:filename>')
|
||||
def serve_www(filename):
|
||||
response = send_from_directory(WWW_DIR, filename)
|
||||
if settings.is_production():
|
||||
response.cache_control.max_age = 86400
|
||||
response.cache_control.public = True
|
||||
return response
|
||||
|
||||
# View blueprint ======================================================
|
||||
|
||||
bp = Blueprint('view_page', __name__)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue