-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
56 lines (43 loc) · 1.43 KB
/
__init__.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
"""This app module which starts the haircut application"""
import os
import logging.config
from flask import Flask, render_template, json, request
# from flask_mysqldb import MySQL
# from apis import api
from database import alchemydb, mysql, Saloon
from apis import blueprint as api
# from werkzeug import generate_password_hash, check_password_hash
logging_conf_path = os.path.normpath(
os.path.join(os.path.dirname(__file__), 'logging.conf'))
logging.config.fileConfig(logging_conf_path)
log = logging.getLogger(__name__)
app = Flask(__name__)
app.config.from_object('config')
# db = SQLAlchemy(app)
with app.app_context():
alchemydb.init_app(app)
# alchemydb.drop_all()
alchemydb.create_all()
@app.route("/")
@app.route('/index.html', alias=True)
@app.route("/main", alias=True)
def default():
""" router for the default url """
return render_template('home.html')
@app.route('/register')
def show_sign_up():
"""This route to signup page"""
return render_template('signup.html')
def main():
"""main function initialize the haircut application"""
log.info('> Starting development server at http://localhost:5000 <')
log.info('> apis running at http://localhost:5000/api <')
# api.init_app(app)
app.register_blueprint(api, url_prefix='/api')
mysql.init_app(app)
print(" test coming here ")
#app.run(debug=True)
main()
if __name__ == "__main__":
#main()
app.run(debug=True)