-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
56 lines (30 loc) · 1.02 KB
/
app.py
File metadata and controls
56 lines (30 loc) · 1.02 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import os
from flask import Flask, jsonify
from flask_restful import Api
from flask_jwt_extended import JWTManager
from marshmallow import ValidationError
from flask_sqlalchemy import SQLAlchemy
from flask_marshmallow import Marshmallow
app = Flask(__name__)
bsdir = os.path.abspath(os.path.dirname(__file__))
print(bsdir)
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///'+os.path.join(bsdir,'data.db')
# app.config['SQLALCHEMY_DATABASE_URI'] = "sqlite:///data.db"
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
app.config['PROPAGATE_EXCEPTIONS'] = True
app.config['SECRET_KEY'] = "mostafa_ghorbani"
api = Api(app)
db = SQLAlchemy(app)
ma = Marshmallow(app)
# jwt = JWTManager(app)
# ==================== URL Routs =====================
from item import item
from store import store
app.register_blueprint(item)
app.register_blueprint(store)
# ====================================================
@app.before_request
def create_tables():
db.create_all()
if __name__ == "__main__":
app.run(debug=True)