コード例 #1
0
ファイル: login.py プロジェクト: KangGwanwoo/pokr.kr
def init_db(app):
    try:
        from social.apps.flask_app import models
        from social.apps.flask_app.models import init_social
        social_storage = init_social(app, Base, db_session)
    except ImportError:
        # FIXME
        pass
コード例 #2
0
def init_db(app):
    try:
        from social.apps.flask_app import models
        from social.apps.flask_app.models import init_social
        social_storage = init_social(app, Base, db_session)
    except ImportError:
        # FIXME
        pass
コード例 #3
0
app = Flask(__name__)
app.config.from_object('flask_example.settings')
app.config.from_object('flask_example.local_settings')

# DB
db = SQLAlchemy(app)
db.metadata.bind = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])

engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'],
                       convert_unicode=True)
db_session = scoped_session(sessionmaker(bind=engine))
Base = declarative_base()
Base.query = db_session.query_property()

app.register_blueprint(social_auth)
social_storage = init_social(app, Base)

login_manager = login.LoginManager()
login_manager.login_view = 'main'
login_manager.login_message = ''
login_manager.setup_app(app)

from flask_example import models
from flask_example import routes


@login_manager.user_loader
def load_user(userid):
    try:
        return models.user.User.query.get(int(userid))
    except (TypeError, ValueError):
コード例 #4
0
ファイル: login.py プロジェクト: nacyot/pokr
def init_db(app):
    from social.apps.flask_app import models
    from social.apps.flask_app.models import init_social
    social_storage = init_social(app, Base, db_session)
コード例 #5
0
ファイル: app.py プロジェクト: dstucrypt/social.eusign
from social.apps.flask_app.routes import social_auth
from social.apps.flask_app.models import init_social
from social.apps.flask_app.template_filters import backends

from flask.ext.sqlalchemy import SQLAlchemy
from flask.ext.login import LoginManager, current_user, logout_user, UserMixin

app = Flask(__name__)
app.config.from_pyfile('config.py')

app.register_blueprint(social_auth)

login_manager = LoginManager()
login_manager.init_app(app)
db = SQLAlchemy(app)
init_social(app, db)

@app.before_request
def set_g_user():
    g.user = current_user._get_current_object()


@login_manager.user_loader
def load_user(userid):
    from models import User
    try:
        return User.query.get(int(userid))
    except (TypeError, ValueError):
        pass

コード例 #6
0
ファイル: app.py プロジェクト: gmerzu/flask-eusign-demo
from flask import Flask
from flask.ext.login import LoginManager
from social.apps.flask_app.routes import social_auth
from social.apps.flask_app.models import init_social

from flask.ext.sqlalchemy import SQLAlchemy

app = Flask(__name__)
app.config.from_pyfile('../local.cfg', silent=True)
app.config.from_pyfile('config.py')

app.register_blueprint(social_auth)

login_manager = LoginManager()
login_manager.init_app(app)
db = SQLAlchemy(app)
init_social(app, db)
コード例 #7
0
    app.config.from_object('flask_example.local_settings')
except ImportError:
    pass

# DB
db = SQLAlchemy(app)
db.metadata.bind = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])

engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'],
                       convert_unicode=True)
session = scoped_session(sessionmaker(bind=engine))
Base = declarative_base()
Base.query = session.query_property()

app.register_blueprint(social_auth)
social_storage = init_social(app, Base, session)

login_manager = login.LoginManager()
login_manager.login_view = 'main'
login_manager.login_message = ''
login_manager.setup_app(app)

from flask_example import models
from flask_example import routes


@login_manager.user_loader
def load_user(userid):
    try:
        return models.user.User.query.get(int(userid))
    except (TypeError, ValueError):
コード例 #8
0
from social.apps.flask_app.routes import social_auth
from social.apps.flask_app.models import init_social
from social.apps.flask_app.template_filters import backends

# App
app = Flask(__name__)
app.config.from_object('example.settings')
app.config.from_object('example.local_settings')

# DB
db = SQLAlchemy(app)
db.metadata.bind = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])

app.register_blueprint(social_auth)
social_storage = init_social(app, db)

login_manager = login.LoginManager()
login_manager.login_view = 'main'
login_manager.login_message = ''
login_manager.setup_app(app)

from example import models
from example import routes


@login_manager.user_loader
def load_user(userid):
    try:
        return models.user.User.query.get(int(userid))
    except (TypeError, ValueError):
コード例 #9
0
app = Flask(__name__)
app.config.from_object('flask_example.settings')
app.config.from_object('flask_example.local_settings')

# DB
db = SQLAlchemy(app)
db.metadata.bind = create_engine(app.config['SQLALCHEMY_DATABASE_URI'])

engine = create_engine(app.config['SQLALCHEMY_DATABASE_URI'],
                       convert_unicode=True)
db_session = scoped_session(sessionmaker(bind=engine))
Base = declarative_base()
Base.query = db_session.query_property()

app.register_blueprint(social_auth)
social_storage = init_social(app, Base)

login_manager = login.LoginManager()
login_manager.login_view = 'main'
login_manager.login_message = ''
login_manager.setup_app(app)

from flask_example import models
from flask_example import routes


@login_manager.user_loader
def load_user(userid):
    try:
        return models.user.User.query.get(int(userid))
    except (TypeError, ValueError):