forked from mia/0x0
Support instance templates
This commit is contained in:
parent
b65209db7b
commit
47ff3a1152
2 changed files with 8 additions and 0 deletions
|
@ -10,6 +10,9 @@ Configuration
|
||||||
To change settings, modify ``instance/config.py``. For more information on
|
To change settings, modify ``instance/config.py``. For more information on
|
||||||
instance configuration, see `the Flask documentation <https://flask.palletsprojects.com/en/2.0.x/config/#instance-folders>`_.
|
instance configuration, see `the Flask documentation <https://flask.palletsprojects.com/en/2.0.x/config/#instance-folders>`_.
|
||||||
|
|
||||||
|
To customize the home and error pages, simply create a ``templates`` directory
|
||||||
|
in your instance directory and copy any templates you want to modify there.
|
||||||
|
|
||||||
If you are running nginx, you should use the ``X-Accel-Redirect`` header.
|
If you are running nginx, you should use the ``X-Accel-Redirect`` header.
|
||||||
To make it work, include this in your nginx config’s ``server`` block::
|
To make it work, include this in your nginx config’s ``server`` block::
|
||||||
|
|
||||||
|
|
5
fhost.py
5
fhost.py
|
@ -23,6 +23,7 @@ from flask import Flask, abort, make_response, redirect, request, send_from_dire
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
from flask_migrate import Migrate
|
from flask_migrate import Migrate
|
||||||
from jinja2.exceptions import *
|
from jinja2.exceptions import *
|
||||||
|
from jinja2 import ChoiceLoader, FileSystemLoader
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from magic import Magic
|
from magic import Magic
|
||||||
from mimetypes import guess_extension
|
from mimetypes import guess_extension
|
||||||
|
@ -68,6 +69,10 @@ app.config.update(
|
||||||
|
|
||||||
if not app.config["TESTING"]:
|
if not app.config["TESTING"]:
|
||||||
app.config.from_pyfile("config.py")
|
app.config.from_pyfile("config.py")
|
||||||
|
app.jinja_loader = ChoiceLoader([
|
||||||
|
FileSystemLoader(str(Path(app.instance_path) / "templates")),
|
||||||
|
app.jinja_loader
|
||||||
|
])
|
||||||
|
|
||||||
if app.config["DEBUG"]:
|
if app.config["DEBUG"]:
|
||||||
app.config["FHOST_USE_X_ACCEL_REDIRECT"] = False
|
app.config["FHOST_USE_X_ACCEL_REDIRECT"] = False
|
||||||
|
|
Loading…
Reference in a new issue