Exemplo n.º 1
0
def main(config_file='config.TestSiteProdConfig', argv=None):
    app = create_app('sme', config_file)

    with app.app_context():
        from kx import celery
        from kx.models import *
        from kx.services import *

        celery_app = app.celery

        worker1 = worker.worker(app=celery_app)
        # worker2 = worker.worker(app=celery_app)

        worker1.run_from_argv('worker', argv=argv)
Exemplo n.º 2
0
from flask.ext.script import Manager
from flask.ext.migrate import Migrate, MigrateCommand
from config import *
import os
from factories import create_app

app = create_app('masjid', Config)

manager = Manager(app)

manager.add_command('db', MigrateCommand)

@manager.command
def syncdb(refresh):

	"""
	logic to create and drop database
	"""

	from locator.models import *
	if refresh:
		db.drop_all()
	db.create_all()
	db.session.flush()

@manager.command
def setup_files():

	from startup import *

	upload_countries()
Exemplo n.º 3
0
import os
import uwsgi

from factories import create_app, initialize_api, initialize_blueprints

app = create_app('sme', 'config.AdminProdConfig')

with app.app_context():
    from kx.views.admin import control

    # Initialize the app blueprints
    initialize_blueprints(app, control)

if __name__ == "__main__":
    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
Exemplo n.º 4
0
from factories import create_app

app = create_app('smart', 'config.Config')

with app.app_context():
    db = app.db
    api = app.api
    migrate = app.migrate
    logger = app.logger
    bcrypt = app.bcrypt
    manager = app.manager


def register_api(cls, *urls, **kwargs):
    """ A simple pass through class to add entities to the api registry """
    kwargs["endpoint"] = getattr(cls, 'resource_name',
                                 kwargs.get("endpoint", None))
    app.api_registry.append((cls, urls, kwargs))
Exemplo n.º 5
0
#! /usr/bin/env python
import flask
from flask_script import Manager
import os
from flask_assets import ManageAssets
from factories import create_app, initialize_api, initialize_blueprints
# from flask_migrate import MigrateCommand
from model_migrations import *
from xlrd import open_workbook
from multiprocessing import Process
from functools import partial

app = create_app('kx', 'config.SiteDevConfig')
app_factory = partial(create_app, 'sme')

# app = create_app('kx', 'config.SiteDevConfig')

logger = app.logger

# Initializing script manager
manager = Manager(app)
# add assets command to it
manager.add_command("assets", ManageAssets(app.assets))

SETUP_DIR = app.config.get("SETUP_DIR")


@manager.command
def runserver():
    """ Start the server"""
    # with app2.app_context():
Exemplo n.º 6
0
"""Application's main module that creates Flask application.

The module is used to provide WSGI server with Flask
application's instance.
"""

from factories import create_app

APP = create_app()
Exemplo n.º 7
0
import os
import uwsgi
import gevent.monkey
import socket

#gevent.monkey.patch_all()

from factories import create_app, initialize_api, initialize_blueprints

app = create_app('sme', 'config.SiteProdConfig')

with app.app_context():
    from kx.views.public import www
    from kx import api, principal
    from kx.resources import resource

    # Initialize the app blueprints
    initialize_blueprints(app, www)
    initialize_api(app, api)

if __name__ == "__main__":

    port = int(os.environ.get('PORT', 5000))
    app.run(host='0.0.0.0', port=port)
Exemplo n.º 8
0
from factories import create_app, initialize_api
import os

app = create_app('monitor', 'config.Config')

with app.app_context():
    from asset import api
    from asset.resources.resource import *
    from asset.views.admin import main

    app.register_blueprint(main)
    initialize_api(app, api)

    if __name__ == "__main__":
        port = int(os.environ.get('PORT', 5000))
        app.run(host='0.0.0.0', port=port)
Exemplo n.º 9
0
# from factories import create_app
# import socket
import time
import logging
# import time
# from daemon import runner
import os
from datetime import datetime
import time

os.chdir('/opt/kx')

from factories import create_app

app_ = create_app('monitor', 'config.MicroTestConfig')

with app_.app_context():
    from kx import celery
    from kx import logger
    import time

    interval = app_.config.get("CELERY_MONITOR_INTERVAL", 120)
    delay = app_.config.get("CELERY_MONITOR_DELAY", 60)

    logger.info("Celery Monitoring starting")
    retries = 0

    while retries < 10:

        result = ping.delay()
        time.sleep(delay)
Exemplo n.º 10
0
#! /usr/bin/env python

from flask_script import Manager
import os
import flask
from factories import create_app, initialize_api, initialize_blueprints
from flask_migrate import MigrateCommand

app = create_app('locales', 'config.LiveConfig')

# Initializing script manager
manager = Manager(app)

logger = app.logger


@manager.command
def runserver():
    """ Start the server"""
    # with app2.app_context():
    from locales.views.public import www
    from locales import api
    from locales.resources import assets

    # Initialize the app blueprints
    initialize_blueprints(app, www)
    initialize_api(app, api)

    port = int(os.environ.get('PORT', 5500))
    app.run(host='0.0.0.0', port=port)
Exemplo n.º 11
0
from factories import create_app
from flask_cors import CORS

app = create_app()
CORS(app, supports_credentials=True)

app.run(host='0.0.0.0',
        port='5000',
        ssl_context=(app.config['SSL_CRT_PATH'], app.config['SSL_KEY_PATH']))
Exemplo n.º 12
0
#! /usr/bin/env python

from flask.ext.script import Manager
import os
from flask.ext.assets import ManageAssets
from factories import create_app, initialize_api, initialize_blueprints
from flask.ext.smartmigrate import Migrate, MigrateCommand
import flask_s3

app = create_app('fitted', 'config.DevConfig')

logger = app.logger

# Initializing script manager
manager = Manager(app)

# Initializing Migrate
manager.add_command('db', MigrateCommand)
# #add assets command to it
manager.add_command("assets", ManageAssets(app.assets))


@manager.command
def runserver():
	""" Start the server"""

	from fitted.views.frontend import main
	
	from fitted.resources import events
	from fitted.services import authentication, products
	from fitted import api
Exemplo n.º 13
0
from flask.ext.bcrypt import Bcrypt
from flask_oauth2_login import GoogleLogin
from flask_login import (
    LoginManager,
)

# from models.user import User
from factories import create_app
from mentorapp.views import (
    admin as admin_views,
    user as user_views
)


dev_env = os.getenv('ENV', default='dev')
app = create_app(__name__, dev_env)
login_manager = LoginManager(app)


# Initialise extensions for the app
admin = Admin(app)
bcrypt = Bcrypt(app)
google = GoogleLogin(app)
app.google = google
db = app.db

# Register the routes for the admin views
admin.add_view(admin_views.Dashboard())

# Register views for the User page
user_views.UserView.register(app)