Exemple #1
0
def main():
    app = Flask(__name__)
    app.config.from_envvar('OSWBLP_SETTINGS')
    app.register_blueprint(views)
    db.init_app(app)
    bcrypt.init_app(app)
    login_manager.init_app(app)
    app.run(host='0.0.0.0')
Exemple #2
0
def create_app(env_name):
    # app initiliazation
    app = Flask(__name__)
    app.config.from_object(app_config[env_name])
    # initializing bcrypt and db
    bcrypt.init_app(app)
    db.init_app(app)
    app.register_blueprint(trip_details_api, url_prefix='/api/v1/trips')

    @app.route('/', methods=['GET'])
    def index():
        """
        example endpoint
        """
        return 'Welcome to NY CAB API Service'

    return app
Exemple #3
0
from flask.ext.restful import Api
from flask.ext.restful.utils import cors
from flask_mail import Mail
from model import db, bcrypt, redis_store
from api.userAPI import UserAPI, LoginAPI, FBUserAPI, FBLoginAPI, ActivateAPI
from api.profileAPI import ProfileAPI, ProfileIconAPI, SearchProfileAPI
from api.friendsAPI import FriendsListAPI, FriendsRequestAPI
from api.passwordAPI import ChangePasswordAPI, ForgetPasswordAPI
from api.postAPI import PostAPI

# load configuration and bootstrap flask
app = Flask(__name__)
app.config.from_object('config')

db.init_app(app)
bcrypt.init_app(app)
redis_store.init_app(app)
mail = Mail(app)

api = Api(app)
api.decorators = [cors.crossdomain(origin='*',
                                   headers='my-header, accept, content-type, token')]

# add endpoints to flask restful api 
api.add_resource(UserAPI, '/create_user')
api.add_resource(LoginAPI, '/login')
api.add_resource(FBUserAPI, '/fb_create_user')
api.add_resource(FBLoginAPI, '/fb_login')
api.add_resource(ActivateAPI, '/activate_account')

api.add_resource(ChangePasswordAPI, '/change_password')
from api.userAPI import UserAPI, LoginAPI, FBUserAPI, FBLoginAPI, ActivateAPI
from api.profileAPI import ProfileAPI, ProfileIconAPI, FindProfileAPI, ViewProfileAPI
from api.lol_teamAPI import LolTeamAPI, MylolTeamAPI, ManagelolTeamAPI, LolTeamIconAPI, SearchlolTeamAPI, ViewlolTeamAPI, InviteTeamRequestAPI, JoinTeamRequestAPI
from api.friendsAPI import FriendsListAPI, FriendsRequestAPI
from api.passwordAPI import ChangePasswordAPI, ForgetPasswordAPI
from api.tournamentAPI import CreateTournamentAPI, JoinTournamentAPI, TournamentResultAPI, ViewTournamentAPI
from api.reportAPI import LolReportAPI
from api.postAPI import PlayerPostAPI, TeamPostAPI
from api.challongeAPI import ChallongeAPI,ChallongeJoinAPI,ChallongeResultAPI
from util.exception import InvalidUsage

app = Flask(__name__)
app.config.from_object('config') 

db.init_app(app)
bcrypt.init_app(app)
redis_store.init_app(app)
mail = Mail(app)

api = Api(app)
api.decorators = [cors.crossdomain(origin='*',
                                   headers='my-header, accept, content-type, token')]

api.add_resource(UserAPI, '/create_user')
api.add_resource(LoginAPI, '/login')
api.add_resource(FBUserAPI, '/fb_create_user')
api.add_resource(FBLoginAPI, '/fb_login')
api.add_resource(ActivateAPI, '/activate_account')

api.add_resource(ChangePasswordAPI, '/change_password')
api.add_resource(ForgetPasswordAPI, '/forget_password')