当前位置: 首页>>代码示例>>Python>>正文


Python Login.as_view方法代码示例

本文整理汇总了Python中login.Login.as_view方法的典型用法代码示例。如果您正苦于以下问题:Python Login.as_view方法的具体用法?Python Login.as_view怎么用?Python Login.as_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在login.Login的用法示例。


在下文中一共展示了Login.as_view方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: route_app

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import as_view [as 别名]
def route_app(app):
    app.add_url_rule('/',
                     view_func=Main.as_view('main'),
                     methods=["GET", "POST"])
    app.add_url_rule('/login',
                     view_func=Login.as_view('login'),
                     methods=["GET", "POST"])
    app.add_url_rule('/logout',
                     view_func=Logout.as_view('logout'))
    return app
开发者ID:solutionspecialist,项目名称:evelope,代码行数:12,代码来源:app.py

示例2: page_not_found

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import as_view [as 别名]
app =flask.Flask(__name__)

app.secret_key = settings.secret_key

#Routes

app.add_url_rule('/',
			view_func=Main.as_view('main'),
			methods=['GET'])

app.add_url_rule('/<page>/',
			view_func=Main.as_view('page'),
			methods=['GET'])

app.add_url_rule('/login',
			view_func=Login.as_view('login'),
			methods=['GET','POST'])
app.add_url_rule('/remote',
			view_func=Remote.as_view('remote'),
			methods=['GET','POST'])
app.add_url_rule('/music',
			view_func=Music.as_view('music'),
			methods=['GET'])

@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'),404

app.debug=True

app.run()
开发者ID:richardqlin,项目名称:flask_demo,代码行数:33,代码来源:app.py

示例3: page_not_found

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import as_view [as 别名]
import flask
import settings

#Views
from main import Main
from login import Login
from remote import Remote
from music import Music

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

#Routes
app.add_url_rule('/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=["GET"])
app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=["GET", "POST"])
app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=["GET", "POST"])
app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=["GET"])

@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'), 404

app.debug = True
app.run()
开发者ID:ovasylev,项目名称:dev-sprint3,代码行数:27,代码来源:app.py

示例4: page_not_found

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import as_view [as 别名]
from remote import Remote
from music import Music
from events import Events
from users import Users
from docs import Docs

# configuration
DATABASE = 'test.json'

app = flask.Flask(__name__)
app.secret_key = settings.secret_key

#URL rules:  add as needed for the various dynamic pages
app.add_url_rule('/', view_func=Main.as_view('main'), methods=('get','post'))
app.add_url_rule('/<page>/', view_func=Main.as_view('main'), methods=('get','post'))
app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=('get','post'))
app.add_url_rule('/remote/', view_func=Remote.as_view('remote'), methods=('get','post'))
app.add_url_rule('/music/', view_func=Music.as_view('music'), methods=('get', 'post'))
app.add_url_rule('/events/', view_func=Events.as_view('events'), methods=('get','post'))
app.add_url_rule('/users/', view_func=Users.as_view('users'), methods=('get','post'))
app.add_url_rule('/docs/', view_func=Docs.as_view('docs'), methods=('get','post'))

#error handling wrapper
@app.errorhandler(404)
def page_not_found(error):
	return flask.render_template('404.html'), 404

#database handling wrappers
@app.before_request
def before_request():
    """Make sure we are connected to the database each request."""
开发者ID:zkastl,项目名称:knights3,代码行数:33,代码来源:app.py

示例5: favicon

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import as_view [as 别名]
### marker for flask app generator - keep this line

# ----------------------------------------
# controllers
# ----------------------------------------

# @app.route('/favicon.ico')
# def favicon():
# 	return send_from_directory(os.path.join(app.root_path, 'static'), 'ico/favicon.ico')

# Routes
# Static main view
# Static main view
app.add_url_rule("/", view_func=Main.as_view("main"), methods=["GET"])
# Dynamic URL rule
app.add_url_rule("/login/", view_func=Login.as_view("login"), methods=["GET", "POST"])
app.add_url_rule("/plans/", view_func=Plans.as_view("plans"), methods=["GET", "POST"])
app.add_url_rule("/about/", view_func=About.as_view("about"), methods=["GET", "POST"])

# @app.errorhandler(404)
# def page_not_found(e):
# 	return render_template('404.html'), 404

# @app.route("/")
# def index():
# 	return render_template('index.html')

# @app.route("/about")
# def about():
# 	return render_template('about.html')
开发者ID:joytafty,项目名称:myflask,代码行数:32,代码来源:app.py

示例6: initDB

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import as_view [as 别名]
app = flask.Flask(__name__)
"""
template_folder='/home/jesus/git/WAPM_rolProyectoiter3/my/templates/'
Se realizan las redirecciones de las peticiones de manera conveniente. Cada peticion
entrante debe estar asociada a una URL, con dicha URL la peticion es canalizada a travez
de las reglas de URL a las funciones que se haran cargo de senrvirlas
"""

initDB()
poblarBD.cargaEstatica()
#
# poblarBD.cargarUsuarios(10)
# poblarBD.cargarProyecto()
# Don't do this
app.secret_key = "bacon"
app.add_url_rule("/", view_func=Login.as_view("index"), methods=["GET", "POST"])


app.add_url_rule("/setVoto/", view_func=SetVoto.as_view("setVoto"), methods=["GET", "POST"])
app.add_url_rule("/listarVotos/", view_func=ListarVotos.as_view("listarVotos"), methods=["GET", "POST"])
app.add_url_rule(
    "/agregarSolicitudCambio/",
    view_func=AgregarSolicitudCambio.as_view("agregarSolicitudCambio"),
    methods=["GET", "POST"],
)
app.add_url_rule("/listarSCVotante/", view_func=ListarSCVotante.as_view("listarSCVotante"), methods=["GET", "POST"])
app.add_url_rule(
    "/listarSCSolicitante/", view_func=ListarSCSolicitante.as_view("listarSCSolicitante"), methods=["GET", "POST"]
)
app.add_url_rule(
    "/listarItemAgregar/", view_func=ListarItemAgregar.as_view("listarItemAgregar"), methods=["GET", "POST"]
开发者ID:jemaromaster,项目名称:WAPM,代码行数:33,代码来源:mainPyUnit.py

示例7: logout

# 需要导入模块: from login import Login [as 别名]
# 或者: from login.Login import as_view [as 别名]
@app.route('/logout/')
def logout():
    if len(session) > 1:
        session['endsession'] = str(datetime.today())
        classdb.registro_bitacora(session['username'], session['startsession'], session['endsession'])
        shutil.rmtree("/var/www/kernotekv3/static/download/"+session['username'])
        session.clear()

        return flask.render_template('cerrarSesion.html')
    
    else:
        session.clear()
    return flask.redirect(flask.url_for('login'))

app.add_url_rule('/login/', view_func=Login.as_view('login'), methods=['POST', 'GET'])
app.add_url_rule('/home/', view_func=Home.as_view('home'), methods=['POST', 'GET'])
app.add_url_rule('/reportes/', view_func=Reportes.as_view('reportes'), methods=['POST', 'GET'])
app.add_url_rule('/turnos/', view_func=Turnos.as_view('turnos'), methods=['GET', 'POST'])
app.add_url_rule('/configuracion/', view_func=Configuracion.as_view('configuracion'), methods=['GET', 'POST'])
app.add_url_rule('/reporte-turno/', view_func=reporteTurno.as_view('reporteTurno'), methods=['GET', 'POST'])


#app.add_url_rule('/logout/', view_func=Logout.as_view('logout'), methods=['POST'])
app.add_url_rule('/reporte-general/', view_func=reporteGeneral.as_view('reporteGeneral'), methods=['POST', 'GET'])
app.add_url_rule('/reporte-especifico/', view_func=reporteEspecifico.as_view('reporteEspecifico'), methods=['GET', 'POST'])
app.add_url_rule('/reporte-detallado', view_func=reporteDetallado.as_view('reporteDetallado'), methods=['GET', 'POST'])
app.add_url_rule('/corte-turno/', view_func=corteTurno.as_view('corteTurno'), methods=['POST', 'GET'])

########## Inicializacion del servidor ##############################
if __name__ == '__main__':
开发者ID:cristian69,项目名称:KernotekV3,代码行数:32,代码来源:__init__.py


注:本文中的login.Login.as_view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。