Example #1
0
babelized_app = Babel(app)
application = babelized_app.app.wsgi_app


class NereidHostChangeMiddleware(object):
    """
    A middleware which alters the HTTP_HOST so that you can test
    the site locally. This middleware replaces the HTTP_HOST with
    the value you prove to the :attr: site

    :param app: The application for which the middleware needs to work
    :param site: The value which should replace HTTP_HOST WSGI Environ
    """
    def __init__(self, app, site):
        self.app = app
        self.site = site

    def __call__(self, environ, start_response):
        environ['HTTP_HOST'] = self.site
        return self.app(environ, start_response)


if __name__ == '__main__':
    # If the file is launched from the CLI then launch the app using the debug
    # web server built into werkzeug
    #app.wsgi_app = NereidHostChangeMiddleware(app.wsgi_app, SITE)
    app.debug = True
    app.static_folder = '%s/templates/%s/static' % (cwd, SITE)
    app.run('0.0.0.0')
app.config.update(CONFIG)
app.initialise()
app.jinja_env.globals.update({'json': json, 'sample': random.sample})


babelized_app = Babel(app)
application = babelized_app.app.wsgi_app

application = Sentry(
    application, Client('http://*****:*****@sentry.openlabs.co.in/10')
)

# If the file is launched from the CLI then launch the app using the debug
# web server built into werkzeug
if __name__ == '__main__':
    class NereidTestMiddleware(object):
        def __init__(self, app, site):
            self.app = app
            self.site = site

        def __call__(self, environ, start_response):
            environ['HTTP_HOST'] = self.site
            return self.app(environ, start_response)
    site = 'my.openlabs.co.in:5000'
    app.wsgi_app = NereidTestMiddleware(app.wsgi_app, site)
    app.debug = False
    app.static_folder = '%s/static' % (cwd,)
    app.session_interface.session_store = \
            FilesystemSessionStore('/tmp', session_class=Session)
    app.run('0.0.0.0')
app.initialise()


class NereidHostChangeMiddleware(object):
    """
    A middleware which alters the HTTP_HOST so that you can test
    the site locally. This middleware replaces the HTTP_HOST with
    the value you prove to the :attr: site

    :param app: The application for which the middleware needs to work
    :param site: The value which should replace HTTP_HOST WSGI Environ
    """
    def __init__(self, app, site):
        self.app = app
        self.site = site

    def __call__(self, environ, start_response):
        environ['HTTP_HOST'] = self.site
        return self.app(environ, start_response)


if __name__ == '__main__':
    # The name of the website
    site = 'test'

    app.wsgi_app = NereidHostChangeMiddleware(app.wsgi_app, site)
    app.debug = True

    app.static_folder = '%s/static' % site
    app.run('0.0.0.0')
Example #4
0
babelized_app = Babel(app)
application = babelized_app.app.wsgi_app

application = Sentry(
    application,
    Client(
        'http://*****:*****@sentry.openlabs.co.in/10'
    ))

# If the file is launched from the CLI then launch the app using the debug
# web server built into werkzeug
if __name__ == '__main__':

    class NereidTestMiddleware(object):
        def __init__(self, app, site):
            self.app = app
            self.site = site

        def __call__(self, environ, start_response):
            environ['HTTP_HOST'] = self.site
            return self.app(environ, start_response)

    site = 'my.openlabs.co.in:5000'
    app.wsgi_app = NereidTestMiddleware(app.wsgi_app, site)
    app.debug = False
    app.static_folder = '%s/static' % (cwd, )
    app.session_interface.session_store = \
            FilesystemSessionStore('/tmp', session_class=Session)
    app.run('0.0.0.0')
babelized_app = Babel(app)
application = babelized_app.app.wsgi_app


class NereidHostChangeMiddleware(object):
    """
    A middleware which alters the HTTP_HOST so that you can test
    the site locally. This middleware replaces the HTTP_HOST with
    the value you prove to the :attr: site

    :param app: The application for which the middleware needs to work
    :param site: The value which should replace HTTP_HOST WSGI Environ
    """
    def __init__(self, app, site):
        self.app = app
        self.site = site

    def __call__(self, environ, start_response):
        environ['HTTP_HOST'] = self.site
        return self.app(environ, start_response)


if __name__ == '__main__':
    # If the file is launched from the CLI then launch the app using the debug
    # web server built into werkzeug
    #app.wsgi_app = NereidHostChangeMiddleware(app.wsgi_app, SITE)
    app.debug = True
    app.static_folder = '%s/templates/%s/static' % (cwd, SITE)
    app.run('0.0.0.0')
Example #6
0
# Initialise the app, connect to cache and backend
app.initialise()


class NereidHostChangeMiddleware(object):
    """
    A middleware which alters the HTTP_HOST so that you can test
    the site locally. This middleware replaces the HTTP_HOST with
    the value you prove to the :attr: site

    :param app: The application for which the middleware needs to work
    :param site: The value which should replace HTTP_HOST WSGI Environ
    """
    def __init__(self, app, site):
        self.app = app
        self.site = site

    def __call__(self, environ, start_response):
        environ['HTTP_HOST'] = self.site
        return self.app(environ, start_response)


if __name__ == '__main__':
    # The name of the website
    site = 'nereidblog.com'

    app.wsgi_app = NereidHostChangeMiddleware(app.wsgi_app, site)
    app.debug = True
    app.static_folder = '{0}/static'.format(site)
    app.run('0.0.0.0')
app.initialise()
app.jinja_env.globals.update({"json": json, "sample": random.sample})


babelized_app = Babel(app)
application = babelized_app.app.wsgi_app

# application = Sentry(
# application, Client('http://sjkdhsadjkwi423y8wkjhwuiy@localhost:9000/7')
# )

# If the file is launched from the CLI then launch the app using the debug
# web server built into werkzeug
if __name__ == "__main__":

    class NereidTestMiddleware(object):
        def __init__(self, app, site):
            self.app = app
            self.site = site

        def __call__(self, environ, start_response):
            environ["HTTP_HOST"] = self.site
            return self.app(environ, start_response)

    site = "localhost:5000"
    app.wsgi_app = NereidTestMiddleware(app.wsgi_app, site)
    app.debug = True
    app.static_folder = "%s/static" % (cwd,)
    app.session_interface.session_store = FilesystemSessionStore("/tmp", session_class=Session)
    app.run("0.0.0.0")