Flask-bootstrap定制Flask-security

时间:2018-02-23 22:09:43

标签: python flask flask-security flask-bootstrap

我正在使用Flask-security,我无法集成Flask-bootstrap以自定义登录,注册和其他页面的用户界面。

项目在这里举办: https://github.com/fbenavides69/control-escolar

我已经通过pip安装了包,可以呈现登录,注册和其他页面,但由于某种原因,我无法让它们呈现用户引导程序。我已经按照c / p中关于应用程序中templates目录下的安全页面的建议来覆盖外观,但没有取得任何成功。

有人可以指出我缺少的东西吗?

以下是login_user.html:

的代码
<div class="row">
               <div class="col">
                   <h3 class="text-center text-primary py-3 text-uppercase">Our Twitch Streamers</h3>
                   <div class="embed-responsive">
                       <iframe src="https://player.twitch.tv/?channel=visviresgames" allowfullscreen="true" scrolling="no" height="378" width="620" class="embed-responsive-item"></iframe>
                   </div>
                   <h3 class="text-center text-primary py-3 text-uppercase">Our Youtube Channel</h3>
                   <div class="embed-responsive">
                       <iframe width="560" height="315" src="https://www.youtube.com/embed/k5JqHLbZP_0" allowfullscreen="true" class="embed-responsive-item"></iframe>
                   </div>
               </div>
           </div>
 </div>

这是layout.html:

{% extends "layout.html" %}

{% block body %}
    {{super()}}

    {% include "navbar.html" %}

    {% block content %}
        {{super()}}

        {% from "security/_macros.html" import render_field_with_errors, render_field %}
        {% from "security/_form_macros.html" import render_field %}
        <div class="container">
        {% include "security/_messages.html" %}
        <h1>{{ _('Login') }}</h1>
        <form action="{{ url_for_security('login') }}" method="POST" name="login_user_form">
          {{ login_user_form.hidden_tag() }}
          {{ render_field_with_errors(login_user_form.email) }}
          {{ render_field_with_errors(login_user_form.password) }}
          {{ render_field_with_errors(login_user_form.remember) }}
          {{ render_field(login_user_form.next) }}
          {{ render_field(login_user_form.submit) }}
        </form>
        {% include "security/_menu.html" %}
        </div>

    {% endblock content %}

{% endblock body %}

以下是存储模板的文件结构:

{% extends "bootstrap/base.html" %}

{% block html_attribs %} 
    lang="sp" 
{% endblock %}
{% block metas %}
    <meta charset="utf-8">
{% endblock %}

这里是init文件的代码:

application
+-site
  +-templates
    +-security
      +- login_user.html
      +- register_user.html

1 个答案:

答案 0 :(得分:1)

事实证明,'templates'目录必须直接放在'application'文件夹下才能工作:

application
  +-site
  +-templates
    +-security