示例#1
0
def get_config():
  config = flask.config.Config(os.environ.get('STETHOSCOPE_API_INSTANCE_PATH', './instance/'))

  # load default config from package
  config.from_object('stethoscope.api.defaults')

  # load config specified via env var
  # should be absolute path to a config file
  config.from_envvar('STETHOSCOPE_API_CONFIG', silent=True)

  # load instance config (config.py from instance/)
  config.from_pyfile('config.py')

  return config
示例#2
0
from depot.manager import DepotManager
from flask import current_app as app, request, make_response, render_template, config, Config
from flask_restful import Resource
from werkzeug.exceptions import BadRequest

from coding_challenge_restful.core.filter_params_pagination import create_filter_params
from coding_challenge_restful.core.import_csv import send_csv_import_task
from coding_challenge_restful.extensions import db
from coding_challenge_restful.model_methods.bulk_csv_methods import BulkCSVUploadMethods
from coding_challenge_restful.model_methods.product_methods import ProductMethods
from coding_challenge_restful.utils.exceptions import exception_handle

config_name = 'coding_challenge_restful.settings.Config'
config = Config("")
config.from_object(config_name)


class Products(Resource):
    decorators = [exception_handle]

    def __init__(self):
        app.logger.info('In the constructor of {}'.format(
            self.__class__.__name__))

    def post(self):
        """

    .. http:post::  /products

        This api will be used to send sku_data_import task to queue
示例#3
0
__version__ = 1

cwd = os.path.dirname(os.path.realpath(__file__))
version_file = os.path.join(cwd, '_version')
app_name = 'notify'

try:
    f = open(version_file, 'r').read()
    __version__ = f.strip()
except IOError:
    # Not present locally
    pass


config = flask.config.Config(cwd, flask.Flask.default_config)
config.from_object(app_name + '.settings')
config.from_pyfile('settings.cfg', silent=True)
if os.getenv(app_name.upper() + '_ENV'):
    env = os.getenv(app_name.upper() + '_ENV')
    config.from_object(app_name + '.settings.' + env)


db = MongoEngine()


def make_app():
    import factory

    application = factory.create_app(app_name, cwd, settings_override=config)
    db.init_app(application)
    return application