Exemple #1
0
def create_admin():
    """Helper function for creating an admin user."""
    from authz.application import create
    app = create(load_admin=False, load_rest_api=False, load_service_api=False)

    openid_identity = raw_input("Please provide an OpenID: ")
    if not openid_identity:
        print "ERROR: Please specify a valid OpenID identity"
        return 1

    full_name = raw_input("Full name (optional): ")
    email = raw_input("Email address (optional): ")

    user = User(
        openid=openid_identity,
        name=full_name,
        email=email)
    user.save()

    print "User with identity '%s' was successfully created" % openid_identity
Exemple #2
0
 def setUp(self):
     """Initialize the application with the test database."""
     self.app = create(extra_config=self)
     self.client = self.app.test_client()
Exemple #3
0
"""
    authz.web
    ~~~~~~~~~~~~~~

    Define Flask application endpoints

    :copyright: (c) 2012 by Ion Scerbatiuc
    :license: BSD
"""
import os.path

from flask import send_from_directory

from authz import application

app = application.create()


@app.route("/favicon.ico")
def favicon():
    """Server the favicon from the static folder."""
    return send_from_directory(
        os.path.join(app.root_path, "static"), "favicon.ico", mimetype="image/vnd.microsoft.icon"
    )


def runserver():
    """Run the Flask app with the internal server."""
    app.run(host="0.0.0.0", debug=True)