This commit is contained in:
Punnamaraju Vinayaka Tejas 2023-07-12 15:37:40 +05:30
parent de094d4bed
commit bda624e4dc
3 changed files with 14 additions and 4 deletions

View file

@ -21,3 +21,9 @@ Suggested way of generating the key is `python -c 'import secrets; print(secrets
### Registration
Since this blog is meant to be updated by a limited number of people, registration is forbidden (403) by default. In addition, registration (/auth/register) and login (/auth/login) URLs are not hyperlinked anywhere. Registration can be opened by including `REGISTER = True`, or closed by including `REGISTER = False`, in the config file.
### Name
The default app name is "Flaskr", and it is visible on the header bar as well as the page title. Including a line `NAME = '<name>'` in the config file replaces "Flaskr" with "<name>".
### Static folder
The default static folder is the one included in the repository. You can use a separate static folder to use your own assets by including a line `STATIC_FOLDER = '<absolute/path/to/folder>'` in the config file.

View file

@ -8,9 +8,13 @@ def create_app(test_config=None):
app.config.from_mapping(
SECRET_KEY='dev',
DATABASE=os.path.join(app.instance_path, 'flaskr.sqlite'),
REGISTER=False
REGISTER=False,
NAME='Flaskr'
)
if app.config.get('STATIC_FOLDER') is not None:
app.static_folder = app.config.get('STATIC_FOLDER')
app.wsgi_app = ProxyFix(
app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_prefix=1
)

View file

@ -1,9 +1,9 @@
<!doctype html>
<title>{% block title %}{% endblock %} - Flaskr</title>
<title>{% block title %}{% endblock %} - {{ config['NAME'] }}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='style.css') }}">
<link rel="icon" type="image/png" href="{{ url_for('static', filename='favicon.png') }}">
<nav>
<h1>Flaskr</h1>
<h1>{{ config['NAME'] }}</h1>
<ul>
{% if g.user %}
<li><span>{{ g.user['username'] }}</span>