Python flask with blueprint

reza andriyunanto
May 21, 2018 · 2 min read
Structure of project
from login_service.modules import app

def run_app():
return app
from flask import Flask
from flask_sqlalchemy import SQLAlchemy
from login_service.modules import settings

app = Flask(__name__)
db = SQLAlchemy(app)

from login_service.modules.login.views import login

app.register_blueprint(login, url_prefix='/api/login')
from flask import Blueprint, jsonify, json
from flask_restful import Api, Resource

login = Blueprint(
'login', #name of module
template_folder='templates' # templates folder
api = Api(login)

class LoginApi(Resource):
def post(self):
// here login process happen


reza andriyunanto

Written by

Backend Engineer, Tech Enthusiasm, Love data and sometime curious about anything.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade