예제 #1
0
# using options.config in run.py (python -m emissary.run -c somefile.py)
app.config.from_object("emissary.config")

app.version = "2.0.0"
app.inbox = Queue()
app.scripts     = None
app.feedmanager = None
app.config["HTTP_BASIC_AUTH_REALM"] = "Emissary " + app.version


# These are response queues that enable the main thread of execution to
# share data with the REST interface. Mainly for reporting the status of crontabs.
app.queues = []
for i in range(cpu_count() * 2):
	q = Queue()
	q.access = time.time()
	app.queues.append(q)

db = SQLAlchemy(app)
api = restful.Api(app, prefix='/v1')

def init():
	# Models are imported here to prevent a circular import where we would
	# import models and the models would import that db object just above us.

	# They're also imported here in this function because they implicitly
	# monkey-patch the threading module, and we might not need that if all we want
	# from the namespace is something like app.version, like in repl.py for example.
	from models import APIKey
	from models import FeedGroup
	from models import Feed
예제 #2
0
# This config is the default and can be overridden by
# using options.config in run.py (python -m emissary.run -c somefile.py)
app.config.from_object("emissary.config")

app.version = "2.1.1"
app.inbox = Queue()
app.scripts = None
app.feedmanager = None
app.config["HTTP_BASIC_AUTH_REALM"] = "Emissary " + app.version

# These are response queues that enable the main thread of execution to
# share data with the REST interface. Mainly for reporting the status of crontabs.
app.queues = []
for i in range(cpu_count() * 2):
    q = Queue()
    q.access = time.time()
    app.queues.append(q)

db = SQLAlchemy(app)
api = restful.Api(app, prefix='/v1')


def init():
    # Models are imported here to prevent a circular import where we would
    # import models and the models would import that db object just above us.

    # They're also imported here in this function because they implicitly
    # monkey-patch the threading module, and we might not need that if all we want
    # from the namespace is something like app.version, like in repl.py for example.
    from models import APIKey
    from models import FeedGroup