-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
37 lines (30 loc) · 924 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from dotenv import load_dotenv
from app import create_app, db
from flask_migrate import Migrate
from app.models import Follow, PostLike, Role, TokenBlocklist, User, Post, Comment, Message
# from flask import request
load_dotenv()
# using default config
app = create_app('default')
migrate = Migrate(app, db)
@app.shell_context_processor
def make_shell_context():
return dict(
db=db,
User=User,
Post=Post,
TokenBlocklist=TokenBlocklist,
Role=Role,
Follow=Follow,
Comment=Comment,
Message=Message,
PostLike=PostLike
)
@app.cli.command()
def test():
import unittest
tests = unittest.TestLoader().discover('tests')
unittest.TextTestRunner(verbosity=2).run(tests)
# @app.errorhandler(405)
# def method_not_allowed(e):
# return abort(400, {"msg": 'custom error message to appear in body'})