-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from msnodeve/release1/fix
[Merge] release1/fix -> master ; 1차 릴리즈 업데이트
- Loading branch information
Showing
25 changed files
with
364 additions
and
533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
GREEN=\033[1;32;40m | ||
RED=\033[1;31;40m | ||
NC=\033[0m # No Color | ||
|
||
database: | ||
@bash -c "echo -e \"${GREEN}[db orm 시작]${NC}\"" | ||
python manage.py db init | ||
python manage.py db migrate | ||
python manage.py db upgrade | ||
|
||
test: | ||
@bash -c "echo -e \"${GREEN}[pytest 시작]${NC}\"" | ||
pipenv run pytest app/tests --cov-report=html:cov_html --cov-report=term --cov=app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,24 @@ | ||
""" | ||
app init | ||
APP을 실행하기 위해 config file | ||
""" | ||
from flask import Flask, render_template, jsonify | ||
from flask_restplus import Resource, Api, fields, reqparse | ||
from flask_sqlalchemy import SQLAlchemy | ||
from sqlalchemy.exc import SQLAlchemyError | ||
from sqlalchemy.sql import text | ||
from flask_marshmallow import Marshmallow | ||
from app.api.database import DB | ||
from app.api import REST_API | ||
|
||
SQLALCHEMY_DATABASE_URI = \ | ||
("mysql+pymysql://{USER}:{PASSWORD}@{ADDR}:{PORT}/{NAME}?charset=utf8") | ||
|
||
# 설명할 API에 대한 것 | ||
MA = Marshmallow() | ||
from flask import Flask | ||
from app.api.database import DB, MA | ||
from app.api import REST_API | ||
from app.constants import SQLALCHEMY_DATABASE_URI_FORMAT | ||
|
||
def create_app() -> (Flask): | ||
""" create_app() 함수를 호출해 앱을 초기화 """ | ||
|
||
""" app config part """ | ||
# 나중에 config는 다 빼야 할 것 같다. | ||
def create_app()->(Flask): | ||
""" create_app()을 호출하여 app을 초기화 """ | ||
app = Flask(__name__) | ||
app.app_context().push() | ||
app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI.format( | ||
USER="root", | ||
PASSWORD="1234", | ||
ADDR="127.0.0.1", | ||
PORT=3306, | ||
NAME="board" | ||
) | ||
|
||
app.config['SQLALCHEMY_DATABASE_URI'] = SQLALCHEMY_DATABASE_URI_FORMAT | ||
app.config['SQLALCHEMY_ECHO'] = True | ||
app.config['DEBUG'] = True | ||
|
||
DB.init_app(app) | ||
REST_API.init_app(app) | ||
MA.init_app(app) | ||
|
||
""" return part """ | ||
|
||
return app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.