def auth(app, _db, mailer): auth = Auth(app, _db, user_model=User) app.pipeline.append(auth.pipe) authroutes = auth.module(__name__) return auth
auth.pipe ] ## add esxtensions from weppy_haml import Haml from weppy_assets import Assets from weppy_bs3 import BS3 app.config.Haml.set_as_default = True # app.config.Haml.auto_reload = True app.use_extension(Haml) app.config.Assets.out_folder = 'gen' app.use_extension(Assets) app.use_extension(BS3) ## exposing functions from controllers auth_routes = auth.module(__name__, url_prefix='account') from controllers import main, campaigns, donations, costs ## assets js_libs = app.ext.Assets.js( ['js/masonry.min.js'], output='libs.js') css = app.ext.Assets.css( ['css/bootstrap-theme.min.css', 'css/app.css'], output='common.css') app.ext.Assets.register('js_libs', js_libs) app.ext.Assets.register('css_all', css)
app.config.auth.single_template = True app.config.auth.registration_verification = False app.config.auth.hmac_key = "SomedayWholePeopleWillbeFucked" db = Database(app, auto_migrate=True) auth = Auth(app, db, user_model=User) app.pipeline = [ SessionManager.cookies('SomedayWholePeopleWillbeFucked'), db.pipe, auth.pipe ] db.define_models(User, Issue) auth_routes = auth.module(__name__) def not_authorized(): redirect(location='/system/login', status_code=302) @app.route('/', methods=["get"], template='pages/index.html') def index(): response.meta.title = 'Bazinga Issue Tracker System' return dict(user={}) @app.route('/me', methods=['get'], template='pages/me.html') @requires(auth.is_logged, not_authorized)
## adding sessions and authorization handlers app.pipeline = [SessionManager.cookies('verySecretKey'), db.pipe, auth.pipe] ## add esxtensions from weppy_haml import Haml from weppy_assets import Assets from weppy_bs3 import BS3 app.config.Haml.set_as_default = True # app.config.Haml.auto_reload = True app.use_extension(Haml) app.config.Assets.out_folder = 'gen' app.use_extension(Assets) app.use_extension(BS3) ## exposing functions from controllers auth_routes = auth.module(__name__, url_prefix='account') from controllers import main, campaigns, donations, costs ## assets js_libs = app.ext.Assets.js(['js/masonry.min.js'], output='libs.js') css = app.ext.Assets.css(['css/bootstrap-theme.min.css', 'css/app.css'], output='common.css') app.ext.Assets.register('js_libs', js_libs) app.ext.Assets.register('css_all', css) ## commands @app.cli.command('cron') def runcron(): from datetime import datetime