示例#1
0
文件: server.py 项目: jivechang/mra
urlmap(layers, "layers")
urlmap(layer, "layers", ())
urlmap(layerstyles, "layers", (), "styles")
urlmap(layerstyle, "layers", (), "styles", ())
urlmap(layerfields, "layers", (), "fields")
# Layergroups:
urlmap(layergroups, "layergroups")
urlmap(layergroup, "layergroups", ())
# OGC Web Services:
urlmap(OWSGlobalSettings, "services", "(wms|wfs|wcs)", "settings")

urls = tuple(urlmap)

mra = MRA(os.path.join(sys.path[0], "mra.yaml"))

mralogs.setup(mra.config["logging"]["level"], mra.config["logging"]["file"],
              mra.config["logging"]["format"])

web.config.debug = mra.config["debug"].get("web_debug", False)
webapp.exceptionManager.raise_all = mra.config["debug"].get("raise_all", False)
HTTPCompatible.return_logs = mra.config["logging"].get("web_logs", False)

for pdir in mra.config["plugins"].get("loadpaths", []):
    plugins.load_plugins_dir(pdir)

app = web.application(urls, globals())

if __name__ == "__main__":
    app.run()

application = app.wsgifunc()
示例#2
0
文件: server.py 项目: juanluisrp/mra
import logging

import mapfile

import webapp
from webapp import HTTPCompatible, urlmap, get_data

import tools
from tools import get_mapfile, get_mapfile_workspace, get_config, href, assert_is_empty

from pyxml import Entries


from extensions import plugins

mralogs.setup(get_config("logging")["level"], get_config("logging")["file"],
              get_config("logging")["format"])

class index(object):
    def GET(self, format):
        return "This is MRA."

class mapfiles(object):
    @HTTPCompatible()
    def GET(self, format):
        mapfiles = []
        for path in tools.get_mapfile_paths():
            try:
                mf = mapfile.Mapfile(path)
            except IOError, OSError:
                continue
            filename = mf.filename.replace(".map", "")