Beispiel #1
0
db.define_models([Campaign, Donation, Cost])

## adding sessions and authorization handlers
app.expose.common_handlers = [
    SessionCookieManager('verySecretKey'), db.handler, auth.handler
]

## exposing functions from controllers
from controllers import main, campaigns, donations, costs

## 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.use_extension(Haml)
app.config.Assets.out_folder = 'gen'
app.use_extension(Assets)
app.use_extension(BS3)

## 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('routes')
def print_routing():
Beispiel #2
0
db.define_models(Campaign, Donation, Cost)

## 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(
Beispiel #3
0
import scipy.io
from weppy import App, response
from weppy.orm import Database
from weppy_bs3 import BS3
from weppy_rest import REST, serialize

from logic.scanning import begin_scan, scan_finished_callback
from serializers.hardware import SpectrumAnalyzerSerializer, FieldProbeSerializer
from serializers.scanning import ScanSerializer, ResultSerializer, ScanResultMatSerializer
from tasks import increase_progress
from utils import CORS

app = App(__name__)
app.config.url_default_namespace = "main"
app.use_extension(BS3)
app.use_extension(REST)

app.config_from_yaml('db.yml', 'db')
db = Database(app, auto_migrate=True)
app.pipeline = [db.pipe, CORS()]

from models.hardware import SpectrumAnalyzer, FieldProbe
from models.scanning import Scan, ScanResult, XResultRow, ScanResultMat

db.define_models(SpectrumAnalyzer, FieldProbe, Scan, ScanResult, XResultRow,
                 ScanResultMat)
from controllers import main, hardware, scanning

analyzers = app.rest_module(__name__,
                            'spectrumanalyzer',
# init database and auth
from <%= appName %>.models.user import User

# init auth before passing db models due to dependencies
# on auth tables in the other models
db = DAL(app)
auth = Auth(
        app, db, usermodel=User
)

# adding sessions and authorization handlers
from <%= appName %>.utils import get_cryptogen_string
app.route.common_handlers = [
    SessionCookieManager(get_cryptogen_string(16)),
    db.handler,
    auth.handler
]

# Extensions
from weppy_haml import Haml
app.config.Haml.set_as_default = True
app.config.Haml.auto_reload = True
app.use_extension(Haml)

# Expose controllers
from <%= appName %>.controllers import *

# Commands
from <%= appName %> import cli
Beispiel #5
0
from weppy.cache import Cache, RedisCache
from weppy.orm import Database
from weppy_haml import Haml
from weppy_sentry import Sentry
from redis import Redis

app = App(__name__)

app.config.static_version = '1.5.0'
app.config.static_version_urls = True
app.config.url_default_namespace = "main"
app.config_from_yaml('redis.yml', 'redis')
app.config_from_yaml('sentry.yml', 'Sentry')
app.config.Haml.set_as_default = True

app.use_extension(Haml)
app.use_extension(Sentry)

from .models import Version, Extension

db = Database(app, auto_migrate=True)
db.define_models(Version, Extension)

redis = Redis(**app.config.redis)
cache = Cache(redis=RedisCache(**app.config.redis))

app.pipeline = [db.pipe]

from .controllers import main, docs, extensions
from . import commands
Beispiel #6
0
from weppy import App, url, request, session, now
from weppy_bs3 import BS3
import os
from weppy.tools import service
from weppy.orm import Model, Field, belongs_to, has_many, Database
from weppy.tools import auth
from weppy.tools import Auth
from weppy.tools.auth import AuthUser

app = App(__name__)

app.use_extension(BS3)
app.config.auth.single_template = True
app.config.auth.registration_verification = False
app.config.auth.hmac_key = "MassiveDynamicRules"


@app.route("/echo/<str:msg>")
def echo(msg):
    return dict(message=msg)


@app.command('setup')
def setup():
    # create the user
    user = User.create(email="*****@*****.**",
                       first_name="ddd",
                       last_name="444",
                       password="******")
    # create an admin group
    admins = auth.create_group("admin")