forked from x4nth055/pythoncode-tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
22 lines (20 loc) · 600 Bytes
/
app.py
File metadata and controls
22 lines (20 loc) · 600 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from flask import Flask
from flask_restful import Api
from models import db
import config
from resources import TaskList
# Create the Flask application and the Flask-RESTful API manager.
app = Flask(__name__)
app.config.from_object(config)
# Initialize the Flask-SQLAlchemy object.
db.init_app(app)
# Create the Flask-RESTful API manager.
api = Api(app)
# Create the endpoints.
api.add_resource(TaskList, '/tasks')
if __name__ == '__main__':
# Create the database tables.
with app.app_context():
db.create_all()
# Start the Flask development web server.
app.run(debug=True)