-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.py
103 lines (91 loc) · 4.38 KB
/
run.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#
# Crafted On Wed Jan 25 2023
#
#
# www.devlan.co.ke
# hello@devlan.co.ke
#
#
# The Devlan Solutions LTD End User License Agreement
# Copyright (c) 2022 Devlan Solutions LTD
#
#
# 1. GRANT OF LICENSE
# Devlan Solutions LTD hereby grants to you (an individual) the revocable, personal, non-exclusive, and nontransferable right to
# install and activate this system on two separated computers solely for your personal and non-commercial use,
# unless you have purchased a commercial license from Devlan Solutions LTD. Sharing this Software with other individuals,
# or allowing other individuals to view the contents of this Software, is in violation of this license.
# You may not make the Software available on a network, or in any way provide the Software to multiple users
# unless you have first purchased at least a multi-user license from Devlan Solutions LTD.
#
# 2. COPYRIGHT
# The Software is owned by Devlan Solutions LTD and protected by copyright law and international copyright treaties.
# You may not remove or conceal any proprietary notices, labels or marks from the Software.
#
#
# 3. RESTRICTIONS ON USE
# You may not, and you may not permit others to
# (a) reverse engineer, decompile, decode, decrypt, disassemble, or in any way derive source code from, the Software;
# (b) modify, distribute, or create derivative works of the Software;
# (c) copy (other than one back-up copy), distribute, publicly display, transmit, sell, rent, lease or
# otherwise exploit the Software.
#
#
# 4. TERM
# This License is effective until terminated.
# You may terminate it at any time by destroying the Software, together with all copies thereof.
# This License will also terminate if you fail to comply with any term or condition of this Agreement.
# Upon such termination, you agree to destroy the Software, together with all copies thereof.
#
#
# 5. NO OTHER WARRANTIES.
# DEVLAN SOLUTIONS LTD DOES NOT WARRANT THAT THE SOFTWARE IS ERROR FREE.
# DEVLAN SOLUTIONS LTD SOFTWARE DISCLAIMS ALL OTHER WARRANTIES WITH RESPECT TO THE SOFTWARE,
# EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
# SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES OR LIMITATIONS
# ON HOW LONG AN IMPLIED WARRANTY MAY LAST, OR THE EXCLUSION OR LIMITATION OF
# INCIDENTAL OR CONSEQUENTIAL DAMAGES,
# SO THE ABOVE LIMITATIONS OR EXCLUSIONS MAY NOT APPLY TO YOU.
# THIS WARRANTY GIVES YOU SPECIFIC LEGAL RIGHTS AND YOU MAY ALSO
# HAVE OTHER RIGHTS WHICH VARY FROM JURISDICTION TO JURISDICTION.
#
#
# 6. SEVERABILITY
# In the event of invalidity of any provision of this license, the parties agree that such invalidity shall not
# affect the validity of the remaining portions of this license.
#
#
# 7. NO LIABILITY FOR CONSEQUENTIAL DAMAGES IN NO EVENT SHALL DEVLAN SOLUTIONS LTD OR ITS SUPPLIERS BE LIABLE TO YOU FOR ANY
# CONSEQUENTIAL, SPECIAL, INCIDENTAL OR INDIRECT DAMAGES OF ANY KIND ARISING OUT OF THE DELIVERY, PERFORMANCE OR
# USE OF THE SOFTWARE, EVEN IF DEVLAN SOLUTIONS LTD HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES
# IN NO EVENT WILL DEVLAN SOLUTIONS LTD LIABILITY FOR ANY CLAIM, WHETHER IN CONTRACT
# TORT OR ANY OTHER THEORY OF LIABILITY, EXCEED THE LICENSE FEE PAID BY YOU, IF ANY.
#
#
import os
from flask_migrate import Migrate
from flask_minify import Minify
from sys import exit
from apps.config import config_dict
from apps import create_app, db
# WARNING: Don't run with debug turned on in production!
DEBUG = (os.getenv('DEBUG', 'True') == 'True')
# The configuration
get_config_mode = 'Debug' if DEBUG else 'Production'
try:
# Load the configuration using the default values
app_config = config_dict[get_config_mode.capitalize()]
except KeyError:
exit('Error: Invalid <config_mode>. Expected values [Debug, Production] ')
app = create_app(app_config)
Migrate(app, db)
if not DEBUG:
Minify(app=app, html=True, js=False, cssless=False)
if DEBUG:
app.logger.info('DEBUG = ' + str(DEBUG) )
app.logger.info('Page Compression = ' + 'FALSE' if DEBUG else 'TRUE' )
app.logger.info('DBMS = ' + app_config.SQLALCHEMY_DATABASE_URI)
app.logger.info('ASSETS_ROOT = ' + app_config.ASSETS_ROOT )
if __name__ == "__main__":
app.run()