Commit d5c5c41c6709c8f74146c15939176ca58dd02fee

Authored by Василь Свідрик
1 parent fa42ef1742
Exists in master

change app.py

Showing 7 changed files with 45 additions and 45 deletions Inline Diff

__pycache__/__init__.cpython-310.pyc
No preview for this file type
__pycache__/app.cpython-310.pyc
No preview for this file type
__pycache__/main.cpython-310.pyc
No preview for this file type
__pycache__/routes.cpython-310.pyc
No preview for this file type
File was created 1 from flask_cors import CORS
2 from flask_babel import Babel
3 from flask_jwt_extended import JWTManager
4 #from k2.k2rout import *
5 from flask import Flask
6 from k2.k2cfg import k2
7
8
9
10 # configure flask app
11 app = Flask(__name__)
12 app.config['SECRET_KEY'] = k2.secret_key
13 app.json.sort_keys = k2.json_sort_keys
14 #app.config.from_object(k2)
15
16
17 # init db
18 k2().init_db(app)
19 CORS(app)
20 jwt = JWTManager(app)
21
22 #translate
23 k2.load_babel_translation_directories()
24 app.config['BABEL_TRANSLATION_DIRECTORIES'] = k2.babel_translation_directories
25 app.config['BABEL_DEFAULT_LOCALE'] = k2.default_language
26 app.config['BABEL_LANGUAGES'] = {
27 'en': 'English',
28 'uk': 'Українська',
29 'pl': 'Polski'
30 }
31 app.config['BABEL_DEFAULT_TIMEZONE'] = k2.timezone
32 babel = Babel(app)
33 babel.init_app(app, locale_selector=k2.get_locale)
34
35 # flask routing
36 from routes import *
37
38 if __name__ == '__main__':
39 app.run()
40
41
42
43
44
45
1 from flask_cors import CORS File was deleted
2 from flask_babel import Babel
3 from flask_jwt_extended import JWTManager
4 #from k2.k2rout import *
5 from flask import Flask
6 from k2.k2cfg import k2
7
8
9
10 # configure flask app
11 app = Flask(__name__)
12 app.config['SECRET_KEY'] = k2.secret_key
13 app.json.sort_keys = k2.json_sort_keys
14 #app.config.from_object(k2)
15
16
17 # init db
18 k2().init_db(app)
19 CORS(app)
20 jwt = JWTManager(app)
21
22 #translate
23 k2.load_babel_translation_directories()
24 app.config['BABEL_TRANSLATION_DIRECTORIES'] = k2.babel_translation_directories
25 app.config['BABEL_DEFAULT_LOCALE'] = k2.default_language
26 app.config['BABEL_LANGUAGES'] = {
27 'en': 'English',
28 'uk': 'Українська',
29 'pl': 'Polski'
30 }
31 app.config['BABEL_DEFAULT_TIMEZONE'] = k2.timezone
32 babel = Babel(app)
33 babel.init_app(app, locale_selector=k2.get_locale)
34
35 # flask routing
36 from routes import *
37
38 if __name__ == '__main__':
39 app.run(debug=True, port=5000)
40 1 from flask_cors import CORS
41 2 from flask_babel import Babel
42 3 from flask_jwt_extended import JWTManager
43 4 #from k2.k2rout import *
44 5 from flask import Flask
45 6 from k2.k2cfg import k2
1 #app = Flask(__name__) 1 #app = Flask(__name__)
2 from main import app 2 from app import app
3 from k2.k2rout import components_bp 3 from k2.k2rout import components_bp
4 app.register_blueprint(components_bp) 4 app.register_blueprint(components_bp)
5 from components.k2test.k2test.views import k2test 5 from components.k2test.k2test.views import k2test
6 app.register_blueprint(k2test, url_prefix='/k2test') 6 app.register_blueprint(k2test, url_prefix='/k2test')