rearranged
This commit is contained in:
parent
f22ad13e46
commit
bb0fd73147
|
@ -1,20 +1,11 @@
|
|||
from flask import Blueprint
|
||||
|
||||
from .decorators import public_endpoint
|
||||
from .manager import login_manager, check_valid_login
|
||||
from .models import db
|
||||
|
||||
__all__ = ['bp', 'db', 'public_endpoint']
|
||||
|
||||
bp = Blueprint('auth', __name__, template_folder='auth')
|
||||
from .blueprint import auth
|
||||
|
||||
|
||||
@bp.record_once
|
||||
def on_registered(state):
|
||||
db.init_app(state.app)
|
||||
|
||||
login_manager.init_app(state.app)
|
||||
state.app.before_request(check_valid_login)
|
||||
# Register views
|
||||
import views
|
||||
views
|
||||
|
||||
|
||||
from .views import *
|
||||
__all__ = ['auth', 'db', 'public_endpoint']
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
from flask import Blueprint
|
||||
|
||||
from .manager import login_manager, check_valid_login
|
||||
from .models import db
|
||||
|
||||
auth = Blueprint('auth', __name__, template_folder='auth')
|
||||
|
||||
|
||||
@auth.record_once
|
||||
def on_registered(state):
|
||||
db.init_app(state.app)
|
||||
|
||||
login_manager.init_app(state.app)
|
||||
state.app.before_request(check_valid_login)
|
|
@ -1,13 +1,13 @@
|
|||
from flask import request, url_for, redirect, render_template
|
||||
from flask.ext.login import login_user
|
||||
|
||||
from . import bp
|
||||
from .blueprint import auth
|
||||
from .decorators import public_endpoint
|
||||
from .forms import LoginForm
|
||||
from .models import User
|
||||
|
||||
|
||||
@bp.route('/login/', methods=['GET', 'POST'])
|
||||
@auth.route('/login/', methods=['GET', 'POST'])
|
||||
@public_endpoint
|
||||
def login():
|
||||
form = LoginForm()
|
||||
|
|
|
@ -1,20 +1,4 @@
|
|||
from flask import Flask
|
||||
|
||||
# from flask.ext.admin import Admin
|
||||
from .app import app
|
||||
|
||||
|
||||
from pytest_bdd_example.dashboard import settings
|
||||
|
||||
from pytest_bdd_example import auth
|
||||
|
||||
|
||||
app = Flask(
|
||||
__name__,
|
||||
static_folder=settings.MEDIA_ROOT,
|
||||
template_folder=settings.TEMPLATES_ROOT,
|
||||
)
|
||||
app.config.from_object('pytest_bdd_example.dashboard.settings')
|
||||
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
|
||||
|
||||
app.register_blueprint(auth.bp, url_prefix='/auth')
|
||||
__all__ = ['app']
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
from flask import Flask
|
||||
|
||||
from pytest_bdd_example.dashboard import settings
|
||||
|
||||
from pytest_bdd_example.auth import auth
|
||||
|
||||
|
||||
app = Flask(
|
||||
__name__,
|
||||
static_folder=settings.MEDIA_ROOT,
|
||||
template_folder=settings.TEMPLATES_ROOT,
|
||||
)
|
||||
app.config.from_object('pytest_bdd_example.dashboard.settings')
|
||||
app.secret_key = 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT'
|
||||
|
||||
|
||||
app.register_blueprint(auth, url_prefix='/auth')
|
|
@ -1,5 +1,7 @@
|
|||
from flask import render_template
|
||||
|
||||
from .app import app
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def index(template='dashboard.html'):
|
||||
|
|
Loading…
Reference in New Issue