Пример #1
0
def main():
    logger.info("Starting google music uploader")
    pidfile = None
    if len(sys.argv) > 1:
        if sys.argv[1] == "--pidfile":
            if len(sys.argv) < 3:
                logger.error("Missing pidfile path")
                return
            pidfile = sys.argv[2]

    if pidfile:
        if not util.make_sure_path_exists(os.path.dirname(pidfile)):
            logger.warning("Error creating pidfile directory %s" % os.path.dirname(pidfile))
            return
        with open(pidfile, "w+") as f:
            logger.debug("Writing pidfile to %s" % pidfile)
            f.write(str(os.getpid()))
    config = util.read_config(DirInfo.AppConfig)

    session_opts = {
        'session.type': 'memory',
        'session.auto': 'true'
    }
    app = SessionMiddleware(bottle.app(), session_opts)

    run(app=app, host='0.0.0.0', port=config['PORT'], debug=True)
Пример #2
0
        if not USER_RE.match(username):
            errors[
                'username_error'] = "invalid username. try just letters and numbers"
            return False

        if not PASS_RE.match(password):
            errors['password_error'] = "invalid password."
            return False
        if password != verify:
            errors['verify_error'] = "password must match"
            return False
        if email != "":
            if not EMAIL_RE.match(email):
                errors['email_error'] = "invalid email address"
                return False
        return True

    connection_string = "mongodb://localhost"
    connection = pymongo.MongoClient(connection_string)
    database = connection.blogging

    posts = blogPostDAO.BlogPostDAO(database)
    users = userDAO.UserDAO(database)
    sessions = sessionDAO.SessionDAO(database)


bottle.debug(True)
bottle.run(server='gae')  # Start the webserver running and wait for requests
app = bottle.app()
Пример #3
0
        errors['email_error'] = ""

        if not USER_RE.match(username):
            errors['username_error'] = "invalid username. try just letters and numbers"
            return False

        if not PASS_RE.match(password):
            errors['password_error'] = "invalid password."
            return False
        if password != verify:
            errors['verify_error'] = "password must match"
            return False
        if email != "":
            if not EMAIL_RE.match(email):
                errors['email_error'] = "invalid email address"
                return False
        return True

    connection_string = "mongodb://localhost"
    connection = pymongo.MongoClient(connection_string)
    database = connection.blogging

    posts = blogPostDAO.BlogPostDAO(database)
    users = userDAO.UserDAO(database)
    sessions = sessionDAO.SessionDAO(database)


bottle.debug(True)
bottle.run(server='gae')         # Start the webserver running and wait for requests
app = bottle.app()