コード例 #1
0
ファイル: raster.py プロジェクト: pacificclimate/pdp_util
    def __init__(self, dsn, config=config):
        '''Initialize the application

           :param config: A config dict that can be read by :py:func:`yaml.load` and includes the key `handlers`. `handlers` must be a list of dicts each containing the keys: `url` and `file`.
           :type config: dict
        '''
        DapServer.__init__(self, None)
        self._config = config
        self.dsn = dsn
コード例 #2
0
ファイル: test_wsgi_app.py プロジェクト: jblarsen/pydap
    def setUp(self):
        """Create an installation."""
        self.install = tempfile.mkdtemp(suffix="pydap")

        # create directory for data with two files
        data = os.path.join(self.install, "data")
        os.mkdir(data)
        os.mkdir(os.path.join(data, "subdir"))
        with open(os.path.join(data, "README.txt"), "w") as fp:
            fp.write("Hello, world!")
        with open(os.path.join(data, "data.foo"), "w") as fp:
            pass

        # create templates directory
        templates = os.path.join(self.install, "templates")
        init(templates)

        app = DapServer(data, templates)
        app.handlers = [DummyHandler]
        app = StaticMiddleware(app, os.path.join(templates, "static"))
        self.app = App(app)
コード例 #3
0
ファイル: test_wsgi_app.py プロジェクト: rsignell-usgs/pydap
    def setUp(self):
        """Create an installation."""
        self.install = tempfile.mkdtemp(suffix="pydap")

        # create directory for data with two files
        data = os.path.join(self.install, "data")
        os.mkdir(data)
        os.mkdir(os.path.join(data, "subdir"))
        with open(os.path.join(data, "README.txt"), "w") as fp:
            fp.write("Hello, world!")
        with open(os.path.join(data, "data.foo"), "w") as fp:
            pass

        # create templates directory
        templates = os.path.join(self.install, "templates")
        init(templates)

        app = DapServer(data, templates)
        app.handlers = [DummyHandler]
        app = StaticMiddleware(app, os.path.join(templates, "static"))
        self.app = App(app)
コード例 #4
0
ファイル: test_wsgi_app.py プロジェクト: rsignell-usgs/pydap
    def setUp(self):
        """Create an installation."""
        self.install = tempfile.mkdtemp(suffix="pydap")

        # create directory for data with two files
        data = os.path.join(self.install, "data")
        os.mkdir(data)
        with open(os.path.join(data, "README.txt"), "w") as fp:
            fp.write("Hello, world!")
        with open(os.path.join(data, "data.foo"), "w") as fp:
            pass

        app = DapServer(data)
        app = StaticMiddleware(app, ("pydap.wsgi", "templates/static"))
        self.app = App(app)
コード例 #5
0
ファイル: wsgi.py プロジェクト: pacificclimate/pydap-test
                        '--interface',
                        required=True,
                        help='Interface to listen on')
    parser.add_argument(
        '-p',
        '--port',
        type=int,
        required=True,
        help='Indicate the port on which to bind the application')
    parser.add_argument('-t',
                        '--threaded',
                        default=False,
                        action='store_true',
                        help='Flag to specify use of Flask in threaded mode')
    args = parser.parse_args()

    basicConfig(format='%(levelname)s:%(name)s:%(asctime)s %(message)s',
                stream=sys.stdout,
                level=DEBUG)

    app = Flask(__name__)
    app.wsgi_app = DapServer(args.config)

    app.run('0.0.0.0',
            args.port,
            use_reloader=True,
            debug=True,
            use_debugger=True,
            threaded=args.threaded,
            extra_files=[args.config])
コード例 #6
0
#!/usr/bin/env python3
#-*- coding:utf-8 -*-

from flask import Flask
from pydap.wsgi.app import DapServer

application = DapServer('/root/moonshot_api/')

app = Flask(__name__)
opendap = DapServer('/path/to/opendap')
app.wsgi_app = opendap
app.run(
    host='0.0.0.0',
    port=80,
    debug=False,
    processes=4,
    threaded=False,
    use_reloader=True,
)