add homepage notice

This commit is contained in:
wangjiacai 2023-04-05 00:09:48 +08:00
parent e0ad3f0059
commit debee86627
3 changed files with 11 additions and 1 deletions

View File

@ -14,6 +14,7 @@ def create_app():
app.config['SECRET_KEY'] = conf['app']['SECRET_KEY'] app.config['SECRET_KEY'] = conf['app']['SECRET_KEY']
app.config['SQLALCHEMY_DATABASE_URI'] = conf['app']['SQLALCHEMY_DATABASE_URI'] app.config['SQLALCHEMY_DATABASE_URI'] = conf['app']['SQLALCHEMY_DATABASE_URI']
app.config['HOMEPAGE_NOTICE'] = conf['app']['HOMEPAGE_NOTICE']
app.config['NETWORK_PROXY'] = conf['network']['PROXY'] app.config['NETWORK_PROXY'] = conf['network']['PROXY']
app.config['OPENAI_API_KEY'] = conf['openai']['API_KEY'] app.config['OPENAI_API_KEY'] = conf['openai']['API_KEY']
app.config['OPENAI_MODEL_NAME'] = conf['openai']['MODEL_NAME'] app.config['OPENAI_MODEL_NAME'] = conf['openai']['MODEL_NAME']

View File

@ -10,7 +10,11 @@ main = Blueprint('main', __name__)
@main.route('/') @main.route('/')
def index(): def index():
return render_template('index.html', user=current_user)
notice = current_app.config['HOMEPAGE_NOTICE']
if notice:
notice = notice.split("\\n")
return render_template('index.html', user=current_user, homepage_notice=notice)
@main.route('/profile') @main.route('/profile')

View File

@ -27,4 +27,9 @@
{% with messages = get_flashed_messages() %} {% with messages = get_flashed_messages() %}
{% if messages %}<div class="notification is-danger">{{ messages[0] }}</div>{% endif %} {% if messages %}<div class="notification is-danger">{{ messages[0] }}</div>{% endif %}
{% endwith %} {% endwith %}
<div id="homepage-notice" class="row" style="margin-top: 100px;">
{% if homepage_notice %}
{% for notice in homepage_notice %}<p>{{ notice }}</p>{% endfor %}
{% endif %}
</div>
{% endblock content %} {% endblock content %}