Beispiel #1
0
"""Options for the redis sessions plugin"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    session_salt = dict(type=str, help="Salt used for session security"),
    session_time = dict(type=int, help="Number of seconds of session inactivity before timeout"),
    cookie_domain = dict(type=str, help="The domain of the session cookie")
)
Beispiel #2
0
oz.options(
    redis_cache_connections=dict(
        type=bool,
        default=True,
        help=
        "Whether to cache the redis connection between requests to prevent TCP slow start"
    ),
    redis_host=dict(type=str, default="localhost", help="Redis host"),
    redis_port=dict(type=int, default=6379, help="Redis port"),
    redis_db=dict(type=int, default=0, help="Redis database number"),
    redis_password=dict(type=str,
                        default=None,
                        help="Password to the redis database"),
    redis_decode_responses=dict(
        type=bool,
        default=False,
        help=
        "Whether to decode redis responses automatically. Keep this False if you're handling binary data in redis."
    ),
    redis_use_ssl=dict(type=bool,
                       default=False,
                       help="Set to True to enable SSL in redis (rediss)."),
    redis_ssl_certfile=dict(
        type=str,
        default=None,
        help="Set to path of client certificate, if needed."),
    redis_ssl_keyfile=dict(
        type=str,
        default=None,
        help="Set to path of client (private) key, if needed."),
    redis_ssl_ca_certs=dict(
        type=str,
        default=None,
        help=
        "Set to path of CA certificate, if needed (e.g., /path/to/custom/ca-cert)."
    ),
    redis_ssl_cert_reqs=dict(
        type=str,
        default=None,
        help=
        "Set to 'required' to require certificates, or 'optional' to make them optional."
    ),
)
Beispiel #3
0
"""Options for the error pages middleware"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    error_pages_template = dict(type=str, default="error_page.html", help="Special error page to render when an error occurs and debug is True. This should come from the error_pages plugin source code."),
)
Beispiel #4
0
"""Options for the aws_cdn plugin"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(aws_access_key=dict(type=str,
                               default=None,
                               help="AWS access key for CDN"),
           aws_secret_key=dict(type=str,
                               default=None,
                               help="AWS secret key for CDN"),
           static_host=dict(type=str, help="CDN hostname for static assets"),
           s3_bucket=dict(type=str,
                          default=None,
                          help="S3 bucket for uploading CDN assets"),
           s3_prefix=dict(
               type=str,
               default="",
               help="S3 key prefix to apply when operating on CDN assets"),
           s3_host=dict(type=str,
                        default=None,
                        help="S3 host to use for signature generation"))
Beispiel #5
0
"""Options for the sqlalchemy plugin."""

from __future__ import (
    absolute_import,
    division,
    print_function,
    with_statement,
    unicode_literals
)

import oz

oz.options(
    db=dict(type=str, help="SQLAlchemy connection string to the database"),
    debug_sql=dict(type=bool, default=False, help="Dump SQL queries performed by SQLAlchemy to stdout"),
    db_pool_size=dict(type=int, default=None, help="Size of the SQLAlchemy connection pool"),
    db_max_overflow=dict(type=int, default=None, help="How many extra transient connections can be put in the SQLAlchemy connection pool if needed"),
    db_pool_timeout=dict(type=int, default=None, help="Number of seconds to wait before a SQLAlchemy connection is returned to the pool"),
    db_pool_pre_ping=dict(type=bool, default=False, help="Enable pessimistic db liveness check on the connection pool."),
)
Beispiel #6
0
from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    db = dict(type=str, help="SQLAlchemy connection string to the database"),
    debug_sql = dict(type=bool, default=False, help="Dump SQL queries performed by SQLAlchemy to stdout"),
    db_pool_size = dict(type=int, default=None, help="Size of the SQLAlchemy connection pool"),
    db_max_overflow = dict(type=int, default=None, help="How many extra transient connections can be put in the SQLAlchemy connection pool if needed"),
    db_pool_timeout = dict(type=int, default=None, help="Number of seconds to wait before a SQLAlchemy connection is returned to the pool"),
)
Beispiel #7
0
from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    session_salt = dict(type=str, help="Salt used for session security"),
    session_time = dict(type=int, help="Number of seconds of session inactivity before timeout")
)
Beispiel #8
0
"""Defines application options"""

import oz
import os
import sys

from rsearcher.query import *
from rsearcher.word2vec import *
from rsearcher.analyst import *

pardir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
word2vec = Word2VecModel(os.path.join(pardir, 'models/word2vec.gensim.model'))

oz.options(
    # Format: <option name> = dict(<option kwargs>)
    # e.g.: port = dict(type=int, default=8000, help="Server port")
    parser=dict(type=QueryParser,
                default=QueryParser(),
                help='QueryParser model'),
    word2vec=dict(type=Word2VecModel, default=word2vec, help='Word2Vec model'),
    analyst=dict(type=Analyst, default=Analyst(word2vec),
                 help='Analyst Model'))
Beispiel #9
0
from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    redis_cache_connections = dict(type=bool, default=True, help="Whether to cache the redis connection between requests to prevent TCP slow start"),
    redis_host = dict(type=str, default="localhost", help="Redis host"),
    redis_port = dict(type=int, default=6379, help="Redis port"),
    redis_db = dict(type=int, default=0, help="Redis database number"),
    redis_password = dict(type=str, default=None, help="Password to the redis database")
)
Beispiel #10
0
from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    debug = dict(type=bool, default=False, help="Debug mode. Stack traces will be displayed on errors, and the server will automatically reload when server code is changed. This should not be enabled in production."),
    port = dict(type=int, default=8000, help="The port on which to run the server."),
    static_path = dict(type=str, default=None, help="Path to the static directory. If set to None, then static asset hosting is disabled."),
    template_path = dict(type=str, default="templates", help="Path to the templates directory."),
    xsrf_cookies = dict(type=bool, default=False, help="Enable cookies that prevent XSRF attacks."),
    cookie_secret = dict(type=str, help="Secret used for secure cookies. Required if you set xsrf_cookies=True."),
    gzip = dict(type=bool, help="Enables gzip output."),
    wsgi_mode = dict(type=bool, default=False, help="Use WSGI mode."),
    server_workers = dict(type=int, default=1, help="The number of server workers to run concurrently."),

    ssl_cert_file = dict(type=str, default=None, help="The SSL certificate file. If unspecified, SSL support will be disabled."),
    ssl_key_file = dict(type=str, default=None, help="The SSL key file. If unspecified, SSL support will be disabled."),
    ssl_cert_reqs = dict(type=int, default=0, help="Whether certificates are required from the other side of the connection. 0 = certificates ignored, 1 = certificates optional, 2 = certificates required."),
    ssl_ca_certs = dict(type=str, default=None, help="SSL CA certificates file.")
)
Beispiel #11
0
"""Options for the core plugin"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    debug = dict(type=bool, default=False, help="Debug mode. Stack traces will be displayed on errors, and the server will automatically reload when server code is changed. This should not be enabled in production."),
    port = dict(type=int, default=8000, help="The port on which to run the server."),
    static_path = dict(type=str, default=None, help="Path to the static directory. If set to None, then static asset hosting is disabled."),
    template_path = dict(type=str, default="templates", help="Path to the templates directory."),
    xsrf_cookies = dict(type=bool, default=False, help="Enable cookies that prevent XSRF attacks."),
    cookie_secret = dict(type=str, help="Secret used for secure cookies. Required if you set xsrf_cookies=True."),
    gzip = dict(type=bool, help="Enables gzip output."),
    server_workers = dict(type=int, default=1, help="The number of server workers to run concurrently."),
    body_timeout = dict(type=int, default=None, help="How long to wait in seconds while reading the request body"),
    xheaders = dict(type=bool, default=False, help="Determine remote_ip from X-Remote-Ip/X-Forwarded-For headers"),
    ssl_cert_file = dict(type=str, default=None, help="The SSL certificate file. If unspecified, SSL support will be disabled."),
    ssl_key_file = dict(type=str, default=None, help="The SSL key file. If unspecified, SSL support will be disabled."),
    ssl_ca_certs = dict(type=str, default=None, help="SSL CA certificates file."),
    ssl_cert_reqs = dict(type=int, default=0, help="Whether certificates are required from the other side of the connection. 0 = certificates ignored, 1 = certificates optional, 2 = certificates required."),
    server_type = dict(type=str, default=None, help="By default, tornado will be started with the default ioloop. If this is set, a custom server can be used instead. Valid options: 'asyncio', 'twisted' or 'wsgi'."),
    use_secure_cookie=dict(type=bool, default=False, help="Set secure cookies with the secure flag"),
    use_hsts=dict(type=bool, default=False, help="Set the Strict-Transport-Security header"),
    use_graceful_shutdown=dict(type=bool, default=True, help="Stop the server gracefully"),
    graceful_shutdown_timeout=dict(type=int, default=5, help="Number of seconds to wait before forcing the server to stop")
)
Beispiel #12
0
"""Options for the redis plugin"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    redis_cache_connections=dict(type=bool, default=True, help="Whether to cache the redis connection between requests to prevent TCP slow start"),
    redis_host=dict(type=str, default="localhost", help="Redis host"),
    redis_port=dict(type=int, default=6379, help="Redis port"),
    redis_db=dict(type=int, default=0, help="Redis database number"),
    redis_password=dict(type=str, default=None, help="Password to the redis database"),
    redis_decode_responses=dict(type=bool, default=False, help="Whether to decode redis responses automatically. Keep this False if you're handling binary data in redis."),
    redis_use_ssl=dict(type=bool, default=False, help="Set to True to enable SSL in redis (rediss)."),
    redis_ssl_certfile=dict(type=str, default=None, help="Set to path of client certificate, if needed."),
    redis_ssl_keyfile=dict(type=str, default=None, help="Set to path of client (private) key, if needed."),
    redis_ssl_ca_certs=dict(type=str, default=None, help="Set to path of CA certificate, if needed (e.g., /path/to/custom/ca-cert)."),
    redis_ssl_cert_reqs=dict(type=str, default=None, help="Set to 'required' to require certificates, or 'optional' to make them optional."),
)
Beispiel #13
0
from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    aws_access_key = dict(type=str, help="AWS access key for CDN"),
    aws_secret_key = dict(type=str, help="AWS secret key for CDN"),
    static_host = dict(type=str, help="CDN hostname for static assets"),
    s3_bucket = dict(type=str, default=None, help="S3 bucket for uploading CDN assets"),
    hash_override = dict(type=str, default="", help="Sets the hash override, which can be changed to forcibly alter all cache buster values")
)
Beispiel #14
0
"""Options for the error pages middleware"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(error_pages_template=dict(
    type=str,
    default="error_page.html",
    help=
    "Special error page to render when an error occurs and debug is True. This should come from the error_pages plugin source code."
), )
Beispiel #15
0
oz.options(
    debug=dict(
        type=bool,
        default=False,
        help=
        "Debug mode. Stack traces will be displayed on errors, and the server will automatically reload when server code is changed. This should not be enabled in production."
    ),
    port=dict(type=int,
              default=8000,
              help="The port on which to run the server."),
    static_path=dict(
        type=str,
        default=None,
        help=
        "Path to the static directory. If set to None, then static asset hosting is disabled."
    ),
    template_path=dict(type=str,
                       default="templates",
                       help="Path to the templates directory."),
    xsrf_cookies=dict(type=bool,
                      default=False,
                      help="Enable cookies that prevent XSRF attacks."),
    cookie_secret=dict(
        type=str,
        help=
        "Secret used for secure cookies. Required if you set xsrf_cookies=True."
    ),
    gzip=dict(type=bool, help="Enables gzip output."),
    server_workers=dict(
        type=int,
        default=1,
        help="The number of server workers to run concurrently."),
    body_timeout=dict(
        type=int,
        default=None,
        help="How long to wait in seconds while reading the request body"),
    xheaders=dict(
        type=bool,
        default=False,
        help="Determine remote_ip from X-Remote-Ip/X-Forwarded-For headers"),
    ssl_cert_file=dict(
        type=str,
        default=None,
        help=
        "The SSL certificate file. If unspecified, SSL support will be disabled."
    ),
    ssl_key_file=dict(
        type=str,
        default=None,
        help="The SSL key file. If unspecified, SSL support will be disabled."
    ),
    ssl_ca_certs=dict(type=str, default=None,
                      help="SSL CA certificates file."),
    ssl_cert_reqs=dict(
        type=int,
        default=0,
        help=
        "Whether certificates are required from the other side of the connection. 0 = certificates ignored, 1 = certificates optional, 2 = certificates required."
    ),
    server_type=dict(
        type=str,
        default=None,
        help=
        "By default, tornado will be started with the default ioloop. If this is set, a custom server can be used instead. Valid options: 'asyncio', 'twisted' or 'wsgi'."
    ),
    use_secure_cookie=dict(type=bool,
                           default=False,
                           help="Set secure cookies with the secure flag"),
    use_hsts=dict(type=bool,
                  default=False,
                  help="Set the Strict-Transport-Security header"),
    use_graceful_shutdown=dict(type=bool,
                               default=True,
                               help="Stop the server gracefully"),
    graceful_shutdown_timeout=dict(
        type=int,
        default=5,
        help="Number of seconds to wait before forcing the server to stop"))
Beispiel #16
0
"""Defines application options"""

import oz

oz.options(
    # Format: <option name> = dict(<option kwargs>)
    # e.g.: port = dict(type=int, default=8000, help="Server port")
)
Beispiel #17
0
"""Options for the aws_cdn plugin"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    aws_access_key = dict(type=str, help="AWS access key for CDN"),
    aws_secret_key = dict(type=str, help="AWS secret key for CDN"),
    static_host = dict(type=str, help="CDN hostname for static assets"),
    s3_bucket = dict(type=str, default=None, help="S3 bucket for uploading CDN assets"),
    s3_host = dict(type=str, default=None, help="S3 host to use for signature generation")
)
Beispiel #18
0
"""Options for the redis sessions plugin"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(session_salt=dict(type=str, help="Salt used for session security"),
           session_time=dict(
               type=int,
               help="Number of seconds of session inactivity before timeout"),
           cookie_domain=dict(type=str,
                              help="The domain of the session cookie"))
Beispiel #19
0
"""Options for the redis plugin"""

from __future__ import absolute_import, division, print_function, with_statement, unicode_literals

import oz

oz.options(
    redis_cache_connections = dict(type=bool, default=True, help="Whether to cache the redis connection between requests to prevent TCP slow start"),
    redis_host = dict(type=str, default="localhost", help="Redis host"),
    redis_port = dict(type=int, default=6379, help="Redis port"),
    redis_db = dict(type=int, default=0, help="Redis database number"),
    redis_password = dict(type=str, default=None, help="Password to the redis database"),
    redis_decode_responses = dict(type=bool, default=False, help="Whether to decode redis responses automatically. Keep this False if you're handling binary data in redis."),
)