-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path__init__.py
57 lines (38 loc) · 1.35 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
57
import os
from flask import Flask, url_for, redirect
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_login import UserMixin, LoginManager, current_user
app = Flask(__name__)
#################################
############ CONFIGURATIONS #####
#################################
# export SECRET_KEY=myskey
# set SECRET_KEY=mykey
app.config['SECRET_KEY'] = 'mykey'
#################################
#### DATABASE SETUPS #############
#################################
basedir = os.path.abspath(os.path.dirname(__file__))
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(basedir, 'data.sqlite')
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
db = SQLAlchemy(app)
Migrate(app, db)
###########################
#### LOGIN CONFIGS #######
#########################
login_manager = LoginManager()
# We can now pass in our app to the login manager
login_manager.init_app(app)
# Tell users what view to go to when they need to login.
login_manager.login_view = "core.index"
###########################
#### BLUEPRINT CONFIGS #######
#########################
# Import these at the top if you want
# We've imported them here for easy reference
from invoice.core.views import core
from invoice.application.views import application
# Register the apps
app.register_blueprint((core))
app.register_blueprint((application))