Commit d5c5c41c6709c8f74146c15939176ca58dd02fee

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

change app.py

Showing 7 changed files with 45 additions and 45 deletions Side-by-side 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
  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()
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(debug=True, port=5000)
1 1 #app = Flask(__name__)
2   -from main import app
  2 +from app import app
3 3 from k2.k2rout import components_bp
4 4 app.register_blueprint(components_bp)
5 5 from components.k2test.k2test.views import k2test