-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathindex.py
31 lines (21 loc) · 826 Bytes
/
index.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
from flask import Flask, request, send_from_directory
from flask_sqlalchemy import SQLAlchemy
import os
# Create instance of flask application
app = Flask(__name__, template_folder='static/build',static_folder='static/build')
app.config.from_pyfile('config.py')
@app.route('/', defaults={'path': ''}, methods=['GET','POST'])
@app.route('/<path:path>', methods=['GET','POST'])
def index(path):
return send_from_directory('static/build', 'index.html')
if app.config.__getitem__("SQLALCHEMY_DATABASE_URI") == "sqlite:///./soen341.db":
# Create db
db = SQLAlchemy(app)
# import api's
from application.api.users import users
from application.api.qa import qa
from application.api.search import search
# Attach api to app
app.register_blueprint(users)
app.register_blueprint(qa)
app.register_blueprint(search)