Пример #1
0
#!/usr/bin/env python
from werkzeug.serving import run_simple

from eventframe import app, eventapp, init_for
from eventframe.models import db

app.debug = True
eventapp.debug = True
application = init_for('development')
db.create_all(app=app)

run_simple('0.0.0.0', 8090, application,
    use_reloader=True, use_debugger=True, use_evalex=True)
Пример #2
0
import eventframe
from eventframe.models import db


def refresh(base, srcdb, dstdb):
    src = create_engine(srcdb)
    dst = create_engine(dstdb)

    tables = base.metadata.tables
    for tbl in tables:
        print('##################################')
        print(tbl)
        print(tables[tbl].select())
        data = src.execute(tables[tbl].select()).fetchall()
        for a in data:
            print(a)
        if data:
            print(tables[tbl].insert())
            dst.execute(tables[tbl].insert(), data)


if __name__ == '__main__':
    import sys
    if len(sys.argv) != 3:
        print >> sys.stderr, "Syntax: %s source-db destination-db" % sys.argv[0]
        print >> sys.stderr, "Example: %s sqlite:///old.db sqlite:///new.db" % sys.argv[
            0]
    else:
        eventframe.init_for('dev')
        refresh(db.Model, sys.argv[1], sys.argv[2])
Пример #3
0
from sqlalchemy import create_engine
import eventframe
from eventframe.models import db


def refresh(base, srcdb, dstdb):
    src = create_engine(srcdb)
    dst = create_engine(dstdb)

    tables = base.metadata.tables
    for tbl in tables:
        print ('##################################')
        print (tbl)
        print (tables[tbl].select())
        data = src.execute(tables[tbl].select()).fetchall()
        for a in data:
            print(a)
        if data:
            print (tables[tbl].insert())
            dst.execute(tables[tbl].insert(), data)

if __name__ == '__main__':
    import sys
    if len(sys.argv) != 3:
        print >> sys.stderr, "Syntax: %s source-db destination-db" % sys.argv[0]
        print >> sys.stderr, "Example: %s sqlite:///old.db sqlite:///new.db" % sys.argv[0]
    else:
        eventframe.init_for('dev')
        refresh(db.Model, sys.argv[1], sys.argv[2])
Пример #4
0
import sys
import os.path

sys.path.insert(0, os.path.dirname(__file__))
from eventframe import eventapp as application, init_for

init_for("production")
Пример #5
0
from urlparse import urlparse

from eventframe import init_for, app

init_for('dev')

REDIS_URL = app.config.get('REDIS_URL', 'redis://localhost:6379/0')

# REDIS_URL is not taken by setup_default_arguments function of rq/scripts/__init__.py
# so, parse it into pieces and give it

r = urlparse(REDIS_URL)
REDIS_HOST = r.hostname
REDIS_PORT = r.port
REDIS_PASSWORD = r.password
REDIS_DB = 0
Пример #6
0
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
from eventframe import eventapp as application, init_for
init_for('production')
Пример #7
0
import sys
import os.path
sys.path.insert(0, os.path.dirname(__file__))
from eventframe import app as application, init_for
init_for('production')