
전체 글

7.Flask 회원가입, 로그인 암호화 및 JWT + Redis
flask로 회원가입, 로그인 암호화 및 JWT를 통한 사이트의 안전성 확보를 하겠습니다.https://github.com/kschoi93/flask-example 패키지 설치pip install flask-jwt-extendedpip install flask-bcryptpip install redis# Ubuntu에서 redis server 설치sudo apt-get updatesudo apt-get install redis toy.models.example_models.py테스트 용도의 user_id와 password를 가지고 있는 User 모델 추가합니다.class User(db.Model): __tablename__ = 'user' id = db.Column(db.Integer, pri..

6.Flask error, exception general handling
6.Flask error, exception general handlingWeb Application 전역에서 발생하는 Error에 대한 Exception을 임의로 작성하여 사용해보겠습니다.https://github.com/kschoi93/flask-example init에 Error handler 등록# general error handler from .common.errors import error_handle error_handle(app) toy.common.errors.py 등록from .exceptions import *def error_handle(app): @app.errorhandler(CustomException) def example_error(e): ..

5.Flask sqlalchemy - get, create
5.Flask sqlalchemy - get, create controller 부터 service 그리고 dao를 작성하여 get과 create를 구현 해보겠습니다. https://github.com/kschoi93/flask-example Controller 작성 example_create_model = example.model('create', { 'name': fields.String }) @example.route('/name/') class ExampleRouteGetId(Resource): def get(self, name: str) -> json: result = example_services.example_route_get_id(name) return {'message':'성공', 'res..

4.Flask restx 적용 + Swagger
4.Flask restx 적용 + Swagger flask restful을 적용하고, Swagger 적용이 되도록 하겠습니다. https://github.com/kschoi93/flask-example flask restx 패키지 설치 pip install flask-restx __init__.py 파일에 코드 추가 및 수정 from flask import Flask from flask_restx import Api from flask_migrate import Migrate from flask_sqlalchemy import SQLAlchemy api = Api( version='1.0', title='toy_project', prefix='/api', contact='', contact_email='..