-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
33 lines (24 loc) · 832 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
from flask import Flask, jsonify, redirect
from app.models import db
from app.resources import Auth, Register, Words, api, jwt
def create_app():
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///project.db'
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config["JWT_SECRET_KEY"] = "o-secret-key" # Change this!
api.add_resource(Auth, "/login")
api.add_resource(Register, "/register")
api.add_resource(Words, "/words")
db.init_app(app)
api.init_app(app)
jwt.init_app(app)
@app.route("/")
def home():
return redirect('https://github.com/DavidTbilisi/mnmwords')
@app.before_first_request
def before_first_request():
db.create_all()
return app
if __name__ == "__main__":
app = create_app()
app.run(debug=True)