Пример #1
0
def main():
    from paste import httpserver
    from paste.urlmap import URLMap
    from paste.urlparser import make_static
    map_app = URLMap()
    map_app['/'] = app
    map_app['/static'] = make_static({}, "static/")
    httpserver.serve(map_app, host='127.0.0.1', port='8080')
Пример #2
0
 def app_for_bazaar_data(self, relpath):
     if relpath == '/.bzr/smart':
         root_transport = get_transport_for_thread(self.root.base)
         wsgi_app = wsgi.SmartWSGIApp(root_transport)
         return wsgi.RelpathSetter(wsgi_app, '', 'loggerhead.path_info')
     else:
         # TODO: Use something here that uses the transport API
         # rather than relying on the local filesystem API.
         base = self.transport.base
         try:
             path = util.local_path_from_url(base)
         except errors.InvalidURL:
             raise httpexceptions.HTTPNotFound()
         else:
             return urlparser.make_static(None, path)
Пример #3
0
 def __call__(self, environ, start_response):
     from paste.urlparser import make_static
     # TODO: all hardcoded paths *will* break eventually.
     graph_dir = '/usr/local/share/zohmg/graph'
     graph = make_static({}, graph_dir)
     return graph(environ, start_response)
Пример #4
0
 def filter(app):
     static_app = make_static(global_config, document_root, cache_max_age)
     app.wsgi_app = Cascade([static_app, app.wsgi_app])
     return app
Пример #5
0
 def __call__(self, environ, start_response):
     from paste.urlparser import make_static
     project_dir = environ['zohmg_project_dir']
     static = make_static({}, project_dir + '/static')
     return static(environ, start_response)
Пример #6
0
 def __call__(self, environ, start_response):
     from paste.urlparser import make_static
     # TODO: all hardcoded paths *will* break eventually.
     graph_dir = '/usr/local/share/zohmg/graph'
     graph = make_static({}, graph_dir)
     return graph(environ, start_response)
Пример #7
0
"""WSGI applications for serving Bazaar branches."""

import os

from paste import urlparser, fileapp

from ..util import convert_file_errors

static = os.path.join(
    os.path.dirname(os.path.dirname(__file__)), 'static')

# Static things can be cached for half a day, we could probably make this
# longer, except for just before rollout times.
static_app = urlparser.make_static(None, static, cache_max_age=12*60*60)

favicon_app = convert_file_errors(fileapp.FileApp(
    os.path.join(static, 'images', 'favicon.ico')))

robots_app = convert_file_errors(fileapp.FileApp(
    os.path.join(static, 'robots.txt')))
Пример #8
0
 def __call__(self, environ, start_response):
     from paste.urlparser import make_static
     project_dir = environ['zohmg_project_dir']
     static = make_static({}, project_dir + '/static')
     return static(environ, start_response)
Пример #9
0
def main():
    from paste import httpserver, urlmap, urlparser
    root_app = urlmap.URLMap()
    root_app["/js"] = urlparser.make_static({}, os.path.join("public", "js"))
    root_app["/"] = app
    httpserver.serve(root_app, host='127.0.0.1', port='8080')