Ejemplo n.º 1
0
    def command_serve(self, options, args):
        '''Starts a local server'''

        static_app = DirectoryApp("static", index_page=None)

        # Create a cascade that looks for static files first,
        #  then tries the other apps
        cascade_app = ExceptionMiddleware(
            cascade.Cascade(
                [static_app,
                 fever.setup_app(),
                 frontend.setup_app()]))

        address = '0.0.0.0' if options.allow_remote_access else 'localhost'
        httpd = make_server(address, options.port, cascade_app)
        print 'Serving on http://%s:%s' % (address, options.port)
        try:
            httpd.serve_forever()
        except KeyboardInterrupt:
            print 'Interrupted by user'
Ejemplo n.º 2
0
def setup_app():
    # Postpone import to avoid circular dependencies
    import fever, frontend, cascade
    return ExceptionMiddleware(
        cascade.Cascade([fever.setup_app(),
                         frontend.setup_app()]))
Ejemplo n.º 3
0
 def command_serve(self, options, args):
     '''Starts a local server'''
 
     static_app = DirectoryApp("static", index_page=None)
     
     # Create a cascade that looks for static files first, 
     #  then tries the other apps
     cascade_app = ExceptionMiddleware(cascade.Cascade([static_app, fever.setup_app(), frontend.setup_app()]))
     
     address = '0.0.0.0' if options.allow_remote_access else 'localhost'        
     httpd = make_server(address, options.port, cascade_app)
     print 'Serving on http://%s:%s' % (address, options.port)
     try:
         httpd.serve_forever()
     except KeyboardInterrupt:
         print 'Interrupted by user'            
Ejemplo n.º 4
0
def setup_app():    
    # Postpone import to avoid circular dependencies
    import fever, frontend, cascade
    return ExceptionMiddleware(cascade.Cascade([fever.setup_app(), frontend.setup_app()]))