-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcar_rental.py
32 lines (25 loc) · 1.07 KB
/
car_rental.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
"""This module initializes application."""
import os
from flask_migrate import Migrate
from app import create_app, db
from app.models import User, Role, Permission, NewsPost, Comment, Car, Rental, Opinion
app = create_app(os.getenv('FLASK_ENV') or 'development')
migrate = Migrate(app, db, render_as_batch=True)
@app.shell_context_processor
def make_shell_context():
"""Creates a shell context that adds the database and app instance and models to the shell session.
:return: Shell context.
:rtype: dict
"""
# return dict(app=app, db=db, User=User, Role=Role, Permission=Permission, Car=Car, NewsPost=NewsPost,
# Comment=Comment, Rental=Rental, Opinion=Opinion)
return dict(db=db, User=User, Role=Role, Permission=Permission, Car=Car, NewsPost=NewsPost, Comment=Comment,
Rental=Rental, Opinion=Opinion)
@app.cli.command()
def test():
"""Run the unit tests."""
import unittest
tests = unittest.TestLoader().discover('tests')
unittest.TextTestRunner(verbosity=2).run(tests)
# if __name__ == '__main__':
# app.run()