Esempio n. 1
0
def run_server():
    if settings.LOG_PATH:
        print "Log path: %s" % settings.LOG_PATH
    print "Backend: %s" % settings.DEFAULT_SEARCHER
    print "Server: %s" % settings.SERVER_TYPE
    print "Listening on: %s:%d" % (settings.SERVER_ADDRESS, settings.SERVER_PORT)
    # launch web server
    server.run()
Esempio n. 2
0
def run_server():
    if settings.LOG_PATH:
        print 'Log path: %s' % settings.LOG_PATH
    print 'Backend: %s' % settings.DEFAULT_SEARCHER
    print 'Server: %s' % settings.SERVER_TYPE
    print 'Listening on: %s:%d' % (settings.SERVER_ADDRESS, settings.SERVER_PORT)
    # launch web server
    server.run()
Esempio n. 3
0
def run_server():
    if settings.LOG_PATH:
        print('Log path: %s' % settings.LOG_PATH)
    print('Backend: %s' % settings.DEFAULT_SEARCHER)
    print('Server: %s' % (settings.SERVER_TYPE or 'development'))
    print('Listening on: {}:{}'.format(settings.SERVER_ADDRESS,
                                       settings.SERVER_PORT))
    # launch web server
    server.run()
Esempio n. 4
0
def run():
    options = get_options()
    # determine app action
    if options.run_tests:
        tests.run_all()
    elif options.show_version:
        pyver = sys.version_info
        print '  Python: v%d.%d.%d' % (pyver.major, pyver.minor, pyver.micro)
        print 'Sherlock: v' + get_version_info('sherlock')
        print '   Flask: v' + get_version_info('flask')
        print 'Pygments: v' + get_version_info('pygments')
        print '  Whoosh: v' + get_version_info('whoosh')
        print 'CherryPy: v' + get_version_info('cherrypy')
    elif options.show_stats:
        # backend stats
        print 'Available indexer backends: %s' % backends.indexer_names()
        print 'Available searcher backends: %s' % backends.searcher_names()
        print 'Current backend: %s' % settings.DEFAULT_SEARCHER
        # indexer stats
        idxr = indexer.get_indexer()
        print 'Total documents indexed: %d' % idxr.doc_count()
        # database stats
        print 'Index Database: %s' % db.DATABASE_PATH
    elif options.run_server:
        print 'Backend: %s' % settings.DEFAULT_SEARCHER
        print 'Server: %s' % server.get_server_type()
        # launch web server
        server.run()
    elif options.reindex:
        path = utils.resolve_path(settings.INDEX_PATH)
        # check path
        if not path.endswith('/'):
            raise Exception('INDEX_PATH must end with a trailing slash. %s' %
                            path)
        if not os.path.exists(path):
            raise Exception('Check INDEX_PATH. Does it exist? %s' % path)
        print 'Indexing path: %s' % path
        if FORCE_INDEX_REBUILD:
            wait_time = 5  # seconds to wait/pause until rebuilding index
            print 'Reindexing everything!'
            print 'Waiting %ss for interrupt...' % wait_time
            import time
            time.sleep(wait_time)
        indexer.index_path(path)
        # record indexed time
        SherlockMeta.set('last_indexed',
                         datetime.now().strftime(SHORT_DATE_FORMAT))
    else:
        print 'Use -h to see options.'
    pass
Esempio n. 5
0
def run():
    options = get_options()
    # determine app action
    if options.run_tests:
        tests.run_all()
    elif options.show_version:
        pyver = sys.version_info
        print '  Python: v%d.%d.%d' % (pyver.major, pyver.minor, pyver.micro)
        print 'Sherlock: v' + get_version_info('sherlock')
        print '   Flask: v' + get_version_info('flask')
        print 'Pygments: v' + get_version_info('pygments')
        print '  Whoosh: v' + get_version_info('whoosh')
        print 'CherryPy: v' + get_version_info('cherrypy')
    elif options.show_stats:
        # backend stats
        print 'Available indexer backends: %s' % backends.indexer_names()
        print 'Available searcher backends: %s' % backends.searcher_names()
        print 'Current backend: %s' % settings.DEFAULT_SEARCHER
        # indexer stats
        idxr = indexer.get_indexer()
        print 'Total documents indexed: %d' % idxr.doc_count()
        # database stats
        print 'Index Database: %s' % db.DATABASE_PATH
    elif options.run_server:
        print 'Backend: %s' % settings.DEFAULT_SEARCHER
        print 'Server: %s' % server.get_server_type()
        # launch web server
        server.run()
    elif options.reindex:
        path = utils.resolve_path(settings.INDEX_PATH)
        # check path
        if not path.endswith('/'):
            raise Exception('INDEX_PATH must end with a trailing slash. %s' % path)
        if not os.path.exists(path):
            raise Exception('Check INDEX_PATH. Does it exist? %s' % path)
        print 'Indexing path: %s' % path
        if FORCE_INDEX_REBUILD:
            wait_time = 5 # seconds to wait/pause until rebuilding index
            print 'Reindexing everything!'
            print 'Waiting %ss for interrupt...' % wait_time
            import time
            time.sleep(wait_time)
        indexer.index_path(path)
        # record indexed time
        SherlockMeta.set('last_indexed', datetime.now().strftime(SHORT_DATE_FORMAT))
    else:
        print 'Use -h to see options.'
    pass
Esempio n. 6
0
def run():
    options = get_options()
    # determine app action
    if options.run_tests:
        tests.run_all()
    elif options.show_version:
        pyver = sys.version_info
        print '  Python: v%d.%d.%d' % (pyver.major, pyver.minor, pyver.micro)
        print '   webapp: v' + get_version_info('webapp')
        print '   Flask: v' + get_version_info('flask')
        print 'CherryPy: v' + get_version_info('cherrypy')
    elif options.run_server:
        print 'Server: %s' % server.get_server_type()
        # launch web server
        server.run()
    else:
        print 'Use -h to see options.'
    pass
Esempio n. 7
0
def run():
    options = get_options()
    # determine app action
    if options.run_tests:
        tests.run_all()
    elif options.show_version:
        pyver = sys.version_info
        print '  Python: v%d.%d.%d' % (pyver.major, pyver.minor, pyver.micro)
        print '   webapp: v' + get_version_info('webapp')
        print '   Flask: v' + get_version_info('flask')
        print 'CherryPy: v' + get_version_info('cherrypy')
    elif options.run_server:
        print 'Server: %s' % server.get_server_type()
        # launch web server
        server.run()
    else:
        print 'Use -h to see options.'
    pass
Esempio n. 8
0
def run():
    server.run()
Esempio n. 9
0
def run():
    config = configuration.get_config()
    host = config.get('webapp', 'host')
    port = config.getint('webapp', 'port')
    server.run(host, port)
Esempio n. 10
0
def run_server():
    print 'Backend: %s' % settings.DEFAULT_SEARCHER
    print 'Server: %s' % settings.SERVER_TYPE
    # launch web server
    server.run()