예제 #1
0
    def setUp(self):
        """Loads the sample application."""

        app_root = os.path.join(os.path.dirname(__file__), 'sample')
        os.chdir(app_root)
        sys.path.insert(0, os.getcwd())
        self.conf = typhoonae.getAppConfig()
        assert self.conf.application == 'sample'
예제 #2
0
    def setUp(self):
        """Loads the sample application."""

        app_root = os.path.join(os.path.dirname(__file__), 'sample')
        os.chdir(app_root)
        sys.path.insert(0, os.getcwd())
        self.conf = typhoonae.getAppConfig()
        assert self.conf.application == 'sample'
예제 #3
0
    def setUp(self):
        """Loads the sample application."""

        self.app_root = os.path.abspath(
            os.path.join(os.path.dirname(__file__), 'sample'))
        self.curr_dir = os.getcwd()
        os.chdir(os.path.abspath(self.app_root))
        sys.path.insert(0, os.getcwd())
        self.conf = typhoonae.getAppConfig()
        assert self.conf.application == 'sample'

        class OptionsMock:
            amqp_host = "localhost"
            auth_domain = "example.com"
            blobstore_path = "/tmp/blobstore"
            current_version_id = None
            datastore = "mongodb"
            develop_mode = False
            fcgi_host = "localhost"
            fcgi_port = 8081
            email = "*****@*****.**"
            environment = ""
            html_error_pages_root = "/tmp/html"
            http_base_auth_enabled = False
            http_port = 8080
            imap_host = "localhost"
            imap_port = 143
            imap_ssl = False
            imap_user = ""
            imap_password = ""
            imap_mailbox = "INBOX"
            internal_address = "localhost:8770"
            login_url = None
            logout_url = None
            multiple = False
            password = ""
            rdbms_sqlite_path = None
            server_name = "host.local"
            server_software = "TyphoonAE"
            set_crontab = False
            smtp_host = "localhost"
            smtp_port = 25
            smtp_user = ""
            smtp_password = ""
            ssl_enabled = False
            ssl_certificate = None
            ssl_certificate_key = None
            upload_url = "upload/"
            use_celery = False
            var = "/tmp/var"
            websocket_disabled = False
            websocket_host = 'localhost'
            websocket_port = 8888
            xmpp_host = "localhost"
            memcache = ""

        self.options = OptionsMock()
예제 #4
0
    def setUp(self):
        """Loads the sample application."""

        self.app_root = os.path.abspath(
            os.path.join(os.path.dirname(__file__), 'sample'))
        self.curr_dir = os.getcwd()
        os.chdir(os.path.abspath(self.app_root))
        sys.path.insert(0, os.getcwd())
        self.conf = typhoonae.getAppConfig()
        assert self.conf.application == 'sample'

        class OptionsMock:
            amqp_host = "localhost"
            auth_domain = "example.com"
            blobstore_path = "/tmp/blobstore"
            current_version_id = None
            datastore = "mongodb"
            develop_mode = False
            fcgi_host = "localhost"
            fcgi_port = 8081
            email = "*****@*****.**"
            environment = ""
            html_error_pages_root = "/tmp/html"
            http_base_auth_enabled = False
            http_port = 8080
            imap_host = "localhost"
            imap_port = 143
            imap_ssl = False
            imap_user = ""
            imap_password = ""
            imap_mailbox = "INBOX"
            internal_address = "localhost:8770"
            login_url = None
            logout_url = None
            multiple = False
            password = ""
            rdbms_sqlite_path = None
            server_name = "host.local"
            server_software = "TyphoonAE"
            set_crontab = False
            smtp_host = "localhost"
            smtp_port = 25
            smtp_user = ""
            smtp_password = ""
            ssl_enabled = False
            ssl_certificate = None
            ssl_certificate_key = None
            upload_url = "upload/"
            use_celery = False
            var = "/tmp/var"
            websocket_disabled = False
            websocket_host = 'localhost'
            websocket_port = 8888
            xmpp_host = "localhost"
            memcache = ""

        self.options = OptionsMock()
예제 #5
0
파일: apptool.py 프로젝트: fajoy/typhoonae
def main():
    """Runs the apptool console script."""

    op = optparse.OptionParser(description=DESCRIPTION, usage=USAGE)

    op.add_option("--auth_domain", dest="auth_domain", metavar="DOMAIN",
                  help="use this value for the AUTH_DOMAIN environment "
                  "variable", default='localhost')

    op.add_option("--amqp_host", dest="amqp_host", metavar="ADDR",
                  help="use this AMQP host", default='localhost')

    op.add_option("--blobstore_path", dest="blobstore_path", metavar="PATH",
                  help="path to use for storing Blobstore file stub data",
                  default=os.path.join('var', 'blobstore'))

    op.add_option("--celery", dest="celery", metavar="FILE",
                  help="write celery configuration to this file",
                  default=os.path.join('etc', 'celeryconfig.py'))

    op.add_option("--celery_imports", dest="celery_imports", metavar="LIST",
                  help="sequence of modules to import when the celery daemon "
                  "starts")

    op.add_option("--crontab", dest="set_crontab", action="store_true",
                  help="set crontab if cron.yaml exists", default=False)

    op.add_option("--current_version_id", dest="current_version_id",
                  metavar="STRING", help="the current version id",
                  default=None)

    op.add_option("--datastore", dest="datastore", metavar="NAME",
                  help="use this Datastore backend (%s)"
                      % '/'.join(sorted(typhoonae.SUPPORTED_DATASTORES)),
                  default='mongodb')

    op.add_option("--develop", dest="develop_mode", action="store_true",
                  help="configure application for development", default=False)

    op.add_option("--disable_websocket", dest="websocket_disabled",
                  action="store_true",
                  help="disable the Web Socket Service backend", default=False)

    op.add_option("--ejabberd", dest="ejabberd", metavar="FILE",
                  help="write ejabberd configuration to this file",
                  default=os.path.join('etc', 'ejabberd.cfg'))

    op.add_option("--email", dest="email", metavar="EMAIL",
                  help="the username to use", default='')

    op.add_option("--environment", dest="environment", metavar="STRING",
                  help="specify additional environment variables", default='')

    op.add_option("--enable_ssl", dest="ssl_enabled", action="store_true",
                  help="enable SSL support", default=False)

    op.add_option("--fcgi_host", dest="fcgi_host", metavar="HOST",
                  help="use this FastCGI host", default='localhost')

    op.add_option("--fcgi_port", dest="fcgi_port", metavar="PORT",
                  help="use this port of the FastCGI host",
                  default=8081)

    op.add_option("--html_error_pages_root", dest="html_error_pages_root",
                  metavar="PATH", help="set root for HTML error pages",
                  default=None)

    op.add_option("--http_base_auth", dest="http_base_auth_enabled",
                  action="store_true",
                  help="enable HTTP base authentication",
                  default=False)

    op.add_option("--http_port", dest="http_port", metavar="PORT",
                  help="port for the HTTP server to listen on",
                  default=8080)

    op.add_option("--https_port", dest="https_port", metavar="PORT",
                  help="use this port for HTTPS",
                  default=8443)

    op.add_option("--imap_host", dest="imap_host", metavar="ADDR",
                  help="use this IMAP host", default="localhost")

    op.add_option("--imap_port", dest="imap_port", metavar="PORT",
                  help="use this IMAP port", type="int", default=143)
    
    op.add_option("--imap_ssl", dest="imap_ssl", metavar="IMAPSSL",
                  action="store_true", help="connect to IMAP server via SSL",
                  default=False)
    
    op.add_option("--imap_user", dest="imap_user", metavar="STRING",
                  help="use this IMAP user", default="")
    
    op.add_option("--imap_password", dest="imap_password", metavar="STRING",
                  help="user this IMAP password", default="")
    
    op.add_option("--imap_mailbox", dest="imap_mailbox", metavar="STRING",
                  help="use this IMAP mailbox", default="INBOX")

    op.add_option("--internal_address", dest="internal_address",
                  metavar="HOST:PORT",
                  help="the internal application host and port",
                  default='localhost:8770')

    op.add_option("--login_url", dest="login_url", metavar="URL",
                  help="login URL", default=None)

    op.add_option("--logout_url", dest="logout_url", metavar="URL",
                  help="logout URL", default=None)

    op.add_option("--multiple", dest="multiple", action="store_true",
                  help="configure multiple applications", default=False)

    op.add_option("--mysql_db", dest="mysql_db", metavar="STRING",
                  help="connect to the given MySQL database",
                  default='typhoonae')

    op.add_option("--mysql_host", dest="mysql_host", metavar="ADDR",
                  help="connect to this MySQL database server",
                  default='127.0.0.1')

    op.add_option("--mysql_passwd", dest="mysql_passwd", metavar="PASSWORD",
                  help="use this password to connect to the MySQL database "
                       "server", default='')

    op.add_option("--mysql_user", dest="mysql_user", metavar="USER",
                  help="use this user to connect to the MySQL database server",
                  default='root')

    op.add_option("--password", dest="password", metavar="PASSWORD",
                  help="the password to use", default='')

    op.add_option("--rdbms_sqlite_path", dest="rdbms_sqlite_path",
                  metavar="PATH",
                  help="path to the sqlite3 file for the RDBMS API")

    op.add_option("--server_name", dest="server_name", metavar="STRING",
                  help="use this server name", default='localhost')

    op.add_option("--server_software", dest="server_software", metavar="STRING",
                  help="use this server software identifier",
                  default=typhoonae.fcgiserver.SERVER_SOFTWARE)

    op.add_option("--smtp_host", dest="smtp_host", metavar="ADDR",
                  help="use this SMTP host", default='localhost')

    op.add_option("--smtp_port", dest="smtp_port", metavar="PORT",
                  help="use this SMTP port", default=25)

    op.add_option("--smtp_user", dest="smtp_user", metavar="STRING",
                  help="use this SMTP user", default='')

    op.add_option("--smtp_password", dest="smtp_password", metavar="STRING",
                  help="use this SMTP password", default='')

    op.add_option("--ssl_certificate", dest="ssl_certificate", metavar="PATH",
                  help="use this SSL certificate file")

    op.add_option("--ssl_certificate_key", dest="ssl_certificate_key",
                  metavar="PATH", help="use this SSL certificate key file")

    op.add_option("--task_time_limit", dest="task_time_limit",
                  metavar="SECONDS",
                  help="Task Queue's task hard time limit in seconds. "
                       "By default unlimited.", default=0)

    op.add_option("--upload_url", dest="upload_url", metavar="URI",
                  help="use this upload URL for the Blobstore configuration "
                       "(no leading '/')",
                  default='upload/')

    op.add_option("--var", dest="var", metavar="PATH",
                  help="use this directory for platform independent data",
                  default=setdir(os.path.abspath(os.path.join('.', 'var'))))

    op.add_option("--websocket_host", dest="websocket_host", metavar="ADDR",
                  help="use this Web Socket host", default="localhost")

    op.add_option("--websocket_port", dest="websocket_port", metavar="PORT",
                  help="use this Web Socket port", default=8888)

    op.add_option("--verbose", dest="verbose", action="store_true",
                  help="set verbosity mode to display all warnings",
                  default=False)

    op.add_option("--xmpp_host", dest="xmpp_host", metavar="ADDR",
                  help="use this XMPP host", default=socket.getfqdn())

    op.add_option("--memcache", dest="memcache", metavar="ADDR:PORT",
                  help="use a to configure the address of memcached servers", 
                  default=[], action="append")

    (options, args) = op.parse_args()

    if sys.argv[-1].startswith('-') or sys.argv[-1] == sys.argv[0]:
        op.print_usage()
        sys.exit(2)

    if options.ssl_enabled and (
            options.ssl_certificate is None or
            options.ssl_certificate_key is None):
        logger.error("must specify --ssl_certificate and --ssl_certificate_key")
        sys.exit(3)

    app_root = sys.argv[-1]

    if not os.path.isabs(app_root):
        app_root = os.path.normpath(os.path.join(os.getcwd(), app_root))

    if options.datastore == 'remote':
        # Prompt for email and password when not set.
        if not options.email:
            options.email = raw_input('Email: ')
        if not options.password:
            options.password = getpass.getpass('Password: '******'a')
        f(options, conf, app_root, default_version, internal=True, mode='a')

    write_httpd_conf()
    if options.multiple:
        write_httpd_conf(True)

    make_blobstore_dirs(
        os.path.abspath(os.path.join(options.blobstore_path, conf.application)))
    write_supervisor_conf(options, conf, app_root)
    write_ejabberd_conf(options)
    if 'queue.yaml' in os.listdir(app_root):
        write_celery_conf(options, conf, app_root)
    write_crontab(options, app_root)
예제 #6
0
def main():
    """Initializes the server."""

    op = optparse.OptionParser(description=DESCRIPTION, usage=USAGE)

    op.add_option("--auth_domain",
                  dest="auth_domain",
                  metavar="DOMAIN",
                  help="use this value for the AUTH_DOMAIN environment "
                  "variable",
                  default='localhost')

    op.add_option("--blobstore_path",
                  dest="blobstore_path",
                  metavar="PATH",
                  help="path to use for storing Blobstore file stub data",
                  default=os.path.join('var', 'blobstore'))

    op.add_option("--current_version_id",
                  dest="current_version_id",
                  metavar="STRING",
                  help="the current version id",
                  default=None)

    op.add_option("--datastore",
                  dest="datastore",
                  metavar="NAME",
                  help="use this Datastore backend (%s)" %
                  '/'.join(sorted(typhoonae.SUPPORTED_DATASTORES)),
                  default='mongodb')

    op.add_option("--debug",
                  dest="debug_mode",
                  action="store_true",
                  help="enables debug mode",
                  default=False)

    op.add_option("--email",
                  dest="email",
                  metavar="EMAIL",
                  help="the username to use",
                  default='')

    op.add_option("--http_port",
                  dest="http_port",
                  metavar="PORT",
                  help="port for the HTTP server to listen on",
                  default=8080)

    op.add_option("--internal_address",
                  dest="internal_address",
                  metavar="HOST:PORT",
                  help="the internal application host and port",
                  default='localhost:8770')

    op.add_option("--login_url",
                  dest="login_url",
                  metavar="URL",
                  help="login URL",
                  default='/_ah/login')

    op.add_option("--logout_url",
                  dest="logout_url",
                  metavar="URL",
                  help="logout URL",
                  default='/_ah/logout')

    op.add_option("--mysql_db",
                  dest="mysql_db",
                  metavar="STRING",
                  help="connect to the given MySQL database",
                  default='typhoonae')

    op.add_option("--mysql_host",
                  dest="mysql_host",
                  metavar="ADDR",
                  help="connect to this MySQL database server",
                  default='127.0.0.1')

    op.add_option("--mysql_passwd",
                  dest="mysql_passwd",
                  metavar="PASSWORD",
                  help="use this password to connect to the MySQL database "
                  "server",
                  default='')

    op.add_option("--mysql_user",
                  dest="mysql_user",
                  metavar="USER",
                  help="use this user to connect to the MySQL database server",
                  default='root')

    op.add_option("--password",
                  dest="password",
                  metavar="PASSWORD",
                  help="the password to use",
                  default='')

    op.add_option("--rdbms_sqlite_path",
                  dest="rdbms_sqlite_path",
                  metavar="PATH",
                  help="path to the sqlite3 file for the RDBMS API")

    op.add_option("--server_name",
                  dest="server_name",
                  metavar="STRING",
                  help="use this server name",
                  default='localhost')

    op.add_option("--server_software",
                  dest="server_software",
                  metavar="STRING",
                  help="use this server software identifier",
                  default=SERVER_SOFTWARE)

    op.add_option("--smtp_host",
                  dest="smtp_host",
                  metavar="ADDR",
                  help="use this SMTP host",
                  default='localhost')

    op.add_option("--smtp_port",
                  dest="smtp_port",
                  metavar="PORT",
                  help="use this SMTP port",
                  default=25)

    op.add_option("--smtp_user",
                  dest="smtp_user",
                  metavar="STRING",
                  help="use this SMTP user",
                  default='')

    op.add_option("--smtp_password",
                  dest="smtp_password",
                  metavar="STRING",
                  help="use this SMTP password",
                  default='')

    op.add_option("--upload_url",
                  dest="upload_url",
                  metavar="URI",
                  help="use this upload URL for the Blobstore configuration "
                  "(no leading '/')",
                  default='upload/')

    op.add_option("--websocket_host",
                  dest="websocket_host",
                  metavar="ADDR",
                  help="use this Web Socket host",
                  default="localhost")

    op.add_option("--websocket_port",
                  dest="websocket_port",
                  metavar="PORT",
                  help="use this Web Socket port",
                  default=8888)

    op.add_option("--xmpp_host",
                  dest="xmpp_host",
                  metavar="ADDR",
                  help="use this XMPP/Jabber host",
                  default='localhost')

    op.add_option("--memcache",
                  dest="memcache",
                  metavar="ADDR:PORT",
                  help="use a to configure the address of memcached servers",
                  default=[],
                  action="append")

    (options, args) = op.parse_args()

    if sys.argv[-1].startswith('-') or sys.argv[-1] == sys.argv[0]:
        op.print_usage()
        sys.exit(2)

    app_root = sys.argv[-1]

    logging.basicConfig(format=LOG_FORMAT)

    if options.debug_mode:
        logging.getLogger().setLevel(logging.DEBUG)
    else:
        logging.getLogger().setLevel(logging.INFO)

    # Change the current working directory to the application root and load
    # the application configuration
    os.chdir(app_root)
    sys.path.insert(0, app_root)
    conf = typhoonae.getAppConfig()

    # Inititalize API proxy stubs
    typhoonae.setupStubs(conf, options)

    # Serve the application
    serve(conf, options)
예제 #7
0
def main():
    """Initializes the server."""

    op = optparse.OptionParser(description=DESCRIPTION, usage=USAGE)

    op.add_option("--auth_domain", dest="auth_domain", metavar="DOMAIN",
                  help="use this value for the AUTH_DOMAIN environment "
                  "variable", default='localhost')

    op.add_option("--blobstore_path", dest="blobstore_path", metavar="PATH",
                  help="path to use for storing Blobstore file stub data",
                  default=os.path.join('var', 'blobstore'))

    op.add_option("--current_version_id", dest="current_version_id",
                  metavar="STRING", help="the current version id",
                  default=None)

    op.add_option("--datastore", dest="datastore", metavar="NAME",
                  help="use this Datastore backend (%s)"
                      % '/'.join(sorted(typhoonae.SUPPORTED_DATASTORES)),
                  default='mongodb')

    op.add_option("--debug", dest="debug_mode", action="store_true",
                  help="enables debug mode", default=False)

    op.add_option("--email", dest="email", metavar="EMAIL",
                  help="the username to use", default='')

    op.add_option("--http_port", dest="http_port", metavar="PORT",
                  help="port for the HTTP server to listen on",
                  default=8080)

    op.add_option("--internal_address", dest="internal_address",
                  metavar="HOST:PORT",
                  help="the internal application host and port",
                  default='localhost:8770')

    op.add_option("--login_url", dest="login_url", metavar="URL",
                  help="login URL", default='/_ah/login')

    op.add_option("--logout_url", dest="logout_url", metavar="URL",
                  help="logout URL", default='/_ah/logout')

    op.add_option("--mysql_db", dest="mysql_db", metavar="STRING",
                  help="connect to the given MySQL database",
                  default='typhoonae')

    op.add_option("--mysql_host", dest="mysql_host", metavar="ADDR",
                  help="connect to this MySQL database server",
                  default='127.0.0.1')

    op.add_option("--mysql_passwd", dest="mysql_passwd", metavar="PASSWORD",
                  help="use this password to connect to the MySQL database "
                       "server", default='')

    op.add_option("--mysql_user", dest="mysql_user", metavar="USER",
                  help="use this user to connect to the MySQL database server",
                  default='root')

    op.add_option("--password", dest="password", metavar="PASSWORD",
                  help="the password to use", default='')

    op.add_option("--rdbms_sqlite_path", dest="rdbms_sqlite_path",
                  metavar="PATH",
                  help="path to the sqlite3 file for the RDBMS API")

    op.add_option("--server_name", dest="server_name", metavar="STRING",
                  help="use this server name", default='localhost')

    op.add_option("--server_software", dest="server_software", metavar="STRING",
                  help="use this server software identifier",
                  default=SERVER_SOFTWARE)

    op.add_option("--smtp_host", dest="smtp_host", metavar="ADDR",
                  help="use this SMTP host", default='localhost')

    op.add_option("--smtp_port", dest="smtp_port", metavar="PORT",
                  help="use this SMTP port", default=25)

    op.add_option("--smtp_user", dest="smtp_user", metavar="STRING",
                  help="use this SMTP user", default='')

    op.add_option("--smtp_password", dest="smtp_password", metavar="STRING",
                  help="use this SMTP password", default='')

    op.add_option("--upload_url", dest="upload_url", metavar="URI",
                  help="use this upload URL for the Blobstore configuration "
                       "(no leading '/')",
                  default='upload/')

    op.add_option("--websocket_host", dest="websocket_host", metavar="ADDR",
                  help="use this Web Socket host", default="localhost")

    op.add_option("--websocket_port", dest="websocket_port", metavar="PORT",
                  help="use this Web Socket port", default=8888)

    op.add_option("--xmpp_host", dest="xmpp_host", metavar="ADDR",
                  help="use this XMPP/Jabber host", default='localhost')

    op.add_option("--memcache", dest="memcache", metavar="ADDR:PORT",
                  help="use a to configure the address of memcached servers", 
                  default=[], action="append")

    (options, args) = op.parse_args()

    if sys.argv[-1].startswith('-') or sys.argv[-1] == sys.argv[0]:
        op.print_usage()
        sys.exit(2)

    app_root = sys.argv[-1]

    logging.basicConfig(format=LOG_FORMAT)

    if options.debug_mode:
        logging.getLogger().setLevel(logging.DEBUG)
    else:
        logging.getLogger().setLevel(logging.INFO)

    # Change the current working directory to the application root and load
    # the application configuration
    os.chdir(app_root)
    sys.path.insert(0, app_root)
    conf = typhoonae.getAppConfig()

    # Inititalize API proxy stubs
    typhoonae.setupStubs(conf, options)

    # Serve the application
    serve(conf, options)
예제 #8
0
def main():
    """Runs the apptool console script."""

    op = optparse.OptionParser(description=DESCRIPTION, usage=USAGE)

    op.add_option("--auth_domain",
                  dest="auth_domain",
                  metavar="DOMAIN",
                  help="use this value for the AUTH_DOMAIN environment "
                  "variable",
                  default='localhost')

    op.add_option("--amqp_host",
                  dest="amqp_host",
                  metavar="ADDR",
                  help="use this AMQP host",
                  default='localhost')

    op.add_option("--blobstore_path",
                  dest="blobstore_path",
                  metavar="PATH",
                  help="path to use for storing Blobstore file stub data",
                  default=os.path.join('var', 'blobstore'))

    op.add_option("--celery",
                  dest="celery",
                  metavar="FILE",
                  help="write celery configuration to this file",
                  default=os.path.join('etc', 'celeryconfig.py'))

    op.add_option("--celery_imports",
                  dest="celery_imports",
                  metavar="LIST",
                  help="sequence of modules to import when the celery daemon "
                  "starts")

    op.add_option("--crontab",
                  dest="set_crontab",
                  action="store_true",
                  help="set crontab if cron.yaml exists",
                  default=False)

    op.add_option("--current_version_id",
                  dest="current_version_id",
                  metavar="STRING",
                  help="the current version id",
                  default=None)

    op.add_option("--datastore",
                  dest="datastore",
                  metavar="NAME",
                  help="use this Datastore backend (%s)" %
                  '/'.join(sorted(typhoonae.SUPPORTED_DATASTORES)),
                  default='mongodb')

    op.add_option("--develop",
                  dest="develop_mode",
                  action="store_true",
                  help="configure application for development",
                  default=False)

    op.add_option("--disable_websocket",
                  dest="websocket_disabled",
                  action="store_true",
                  help="disable the Web Socket Service backend",
                  default=False)

    op.add_option("--ejabberd",
                  dest="ejabberd",
                  metavar="FILE",
                  help="write ejabberd configuration to this file",
                  default=os.path.join('etc', 'ejabberd.cfg'))

    op.add_option("--email",
                  dest="email",
                  metavar="EMAIL",
                  help="the username to use",
                  default='')

    op.add_option("--environment",
                  dest="environment",
                  metavar="STRING",
                  help="specify additional environment variables",
                  default='')

    op.add_option("--enable_ssl",
                  dest="ssl_enabled",
                  action="store_true",
                  help="enable SSL support",
                  default=False)

    op.add_option("--fcgi_host",
                  dest="fcgi_host",
                  metavar="HOST",
                  help="use this FastCGI host",
                  default='localhost')

    op.add_option("--fcgi_port",
                  dest="fcgi_port",
                  metavar="PORT",
                  help="use this port of the FastCGI host",
                  default=8081)

    op.add_option("--html_error_pages_root",
                  dest="html_error_pages_root",
                  metavar="PATH",
                  help="set root for HTML error pages",
                  default=None)

    op.add_option("--http_base_auth",
                  dest="http_base_auth_enabled",
                  action="store_true",
                  help="enable HTTP base authentication",
                  default=False)

    op.add_option("--http_port",
                  dest="http_port",
                  metavar="PORT",
                  help="port for the HTTP server to listen on",
                  default=8080)

    op.add_option("--https_port",
                  dest="https_port",
                  metavar="PORT",
                  help="use this port for HTTPS",
                  default=8443)

    op.add_option("--imap_host",
                  dest="imap_host",
                  metavar="ADDR",
                  help="use this IMAP host",
                  default="localhost")

    op.add_option("--imap_port",
                  dest="imap_port",
                  metavar="PORT",
                  help="use this IMAP port",
                  type="int",
                  default=143)

    op.add_option("--imap_ssl",
                  dest="imap_ssl",
                  metavar="IMAPSSL",
                  action="store_true",
                  help="connect to IMAP server via SSL",
                  default=False)

    op.add_option("--imap_user",
                  dest="imap_user",
                  metavar="STRING",
                  help="use this IMAP user",
                  default="")

    op.add_option("--imap_password",
                  dest="imap_password",
                  metavar="STRING",
                  help="user this IMAP password",
                  default="")

    op.add_option("--imap_mailbox",
                  dest="imap_mailbox",
                  metavar="STRING",
                  help="use this IMAP mailbox",
                  default="INBOX")

    op.add_option("--internal_address",
                  dest="internal_address",
                  metavar="HOST:PORT",
                  help="the internal application host and port",
                  default='localhost:8770')

    op.add_option("--login_url",
                  dest="login_url",
                  metavar="URL",
                  help="login URL",
                  default=None)

    op.add_option("--logout_url",
                  dest="logout_url",
                  metavar="URL",
                  help="logout URL",
                  default=None)

    op.add_option("--multiple",
                  dest="multiple",
                  action="store_true",
                  help="configure multiple applications",
                  default=False)

    op.add_option("--mysql_db",
                  dest="mysql_db",
                  metavar="STRING",
                  help="connect to the given MySQL database",
                  default='typhoonae')

    op.add_option("--mysql_host",
                  dest="mysql_host",
                  metavar="ADDR",
                  help="connect to this MySQL database server",
                  default='127.0.0.1')

    op.add_option("--mysql_passwd",
                  dest="mysql_passwd",
                  metavar="PASSWORD",
                  help="use this password to connect to the MySQL database "
                  "server",
                  default='')

    op.add_option("--mysql_user",
                  dest="mysql_user",
                  metavar="USER",
                  help="use this user to connect to the MySQL database server",
                  default='root')

    op.add_option("--password",
                  dest="password",
                  metavar="PASSWORD",
                  help="the password to use",
                  default='')

    op.add_option("--rdbms_sqlite_path",
                  dest="rdbms_sqlite_path",
                  metavar="PATH",
                  help="path to the sqlite3 file for the RDBMS API")

    op.add_option("--server_name",
                  dest="server_name",
                  metavar="STRING",
                  help="use this server name",
                  default='localhost')

    op.add_option("--server_software",
                  dest="server_software",
                  metavar="STRING",
                  help="use this server software identifier",
                  default=typhoonae.fcgiserver.SERVER_SOFTWARE)

    op.add_option("--smtp_host",
                  dest="smtp_host",
                  metavar="ADDR",
                  help="use this SMTP host",
                  default='localhost')

    op.add_option("--smtp_port",
                  dest="smtp_port",
                  metavar="PORT",
                  help="use this SMTP port",
                  default=25)

    op.add_option("--smtp_user",
                  dest="smtp_user",
                  metavar="STRING",
                  help="use this SMTP user",
                  default='')

    op.add_option("--smtp_password",
                  dest="smtp_password",
                  metavar="STRING",
                  help="use this SMTP password",
                  default='')

    op.add_option("--ssl_certificate",
                  dest="ssl_certificate",
                  metavar="PATH",
                  help="use this SSL certificate file")

    op.add_option("--ssl_certificate_key",
                  dest="ssl_certificate_key",
                  metavar="PATH",
                  help="use this SSL certificate key file")

    op.add_option("--task_time_limit",
                  dest="task_time_limit",
                  metavar="SECONDS",
                  help="Task Queue's task hard time limit in seconds. "
                  "By default unlimited.",
                  default=0)

    op.add_option("--upload_url",
                  dest="upload_url",
                  metavar="URI",
                  help="use this upload URL for the Blobstore configuration "
                  "(no leading '/')",
                  default='upload/')

    op.add_option("--var",
                  dest="var",
                  metavar="PATH",
                  help="use this directory for platform independent data",
                  default=setdir(os.path.abspath(os.path.join('.', 'var'))))

    op.add_option("--websocket_host",
                  dest="websocket_host",
                  metavar="ADDR",
                  help="use this Web Socket host",
                  default="localhost")

    op.add_option("--websocket_port",
                  dest="websocket_port",
                  metavar="PORT",
                  help="use this Web Socket port",
                  default=8888)

    op.add_option("--verbose",
                  dest="verbose",
                  action="store_true",
                  help="set verbosity mode to display all warnings",
                  default=False)

    op.add_option("--xmpp_host",
                  dest="xmpp_host",
                  metavar="ADDR",
                  help="use this XMPP host",
                  default=socket.getfqdn())

    op.add_option("--memcache",
                  dest="memcache",
                  metavar="ADDR:PORT",
                  help="use a to configure the address of memcached servers",
                  default=[],
                  action="append")

    (options, args) = op.parse_args()

    if sys.argv[-1].startswith('-') or sys.argv[-1] == sys.argv[0]:
        op.print_usage()
        sys.exit(2)

    if options.ssl_enabled and (options.ssl_certificate is None
                                or options.ssl_certificate_key is None):
        logger.error(
            "must specify --ssl_certificate and --ssl_certificate_key")
        sys.exit(3)

    app_root = sys.argv[-1]

    if not os.path.isabs(app_root):
        app_root = os.path.normpath(os.path.join(os.getcwd(), app_root))

    if options.datastore == 'remote':
        # Prompt for email and password when not set.
        if not options.email:
            options.email = raw_input('Email: ')
        if not options.password:
            options.password = getpass.getpass('Password: '******'a')
        f(options, conf, app_root, default_version, internal=True, mode='a')

    write_httpd_conf()
    if options.multiple:
        write_httpd_conf(True)

    make_blobstore_dirs(
        os.path.abspath(os.path.join(options.blobstore_path,
                                     conf.application)))
    write_supervisor_conf(options, conf, app_root)
    write_ejabberd_conf(options)
    if 'queue.yaml' in os.listdir(app_root):
        write_celery_conf(options, conf, app_root)
    write_crontab(options, app_root)