Commit bb7b38c86afa7acf3b419f9dcea0e3f5df4fdba0

Authored by Яна Степаненко
1 parent e002d7855c
Exists in master

Adding a Component adm JWTtoken

Showing 14 changed files with 12 additions and 3 deletions Side-by-side Diff

__pycache__/main.cpython-310.pyc
No preview for this file type
__pycache__/routes.cpython-310.pyc
No preview for this file type
components/__pycache__/__init__.cpython-310.pyc
No preview for this file type
components/k2test/__pycache__/__init__.cpython-310.pyc
No preview for this file type
components/k2test/k2test/__pycache__/__init__.cpython-310.pyc
No preview for this file type
components/k2test/k2test/__pycache__/views.cpython-310.pyc
No preview for this file type
components/k2test/k2test/views.py
... ... @@ -11,7 +11,7 @@
11 11  
12 12  
13 13 @k2test.route('/new')
14   -def new_component():
  14 +def new_component():
15 15 db = k2.extensions['sqlalchemy'].db
16 16 connection = db.engine.connect()
17 17 query = db.text("SELECT email, login FROM k2users")
18 18  
... ... @@ -24,11 +24,11 @@
24 24 @k2test.route('/new2')
25 25 def new_component2():
26 26 return render_template('new2.html')
27   -
  27 +
28 28 @k2test.route('/new3')
29 29 def new_component3():
30 30 return 'сторінка 3'
31   -
  31 +
32 32 @k2test.route('/new4')
33 33 def new_component4():
34 34 return 'сторінка 4'
No preview for this file type
k2/__pycache__/__init__.cpython-310.pyc
No preview for this file type
k2/__pycache__/k2cfg.cpython-310.pyc
No preview for this file type
k2/__pycache__/k2inst.cpython-310.pyc
No preview for this file type
k2/__pycache__/k2obj.cpython-310.pyc
No preview for this file type
1 1 from flask_cors import CORS
2 2 from flask_babel import Babel
  3 +from flask_jwt_extended import JWTManager
3 4 #from k2.k2inst import *
4 5 from flask import Flask
5 6 from k2.k2cfg import k2
6 7  
... ... @@ -7,11 +8,13 @@
7 8 # configure flask app
8 9 app = Flask(__name__)
9 10 app.config['SECRET_KEY'] = k2.secret_key
  11 +
10 12 #app.config.from_object(k2)
11 13  
12 14 # init db
13 15 k2().init_db(app)
14 16 CORS(app)
  17 +jwt = JWTManager(app)
15 18  
16 19 #translate
17 20 k2.load_babel_translation_directories()
... ... @@ -6,4 +6,7 @@
6 6  
7 7 from components.k2test.k2test.views import k2test
8 8 app.register_blueprint(k2test, url_prefix='/k2test')
  9 +
  10 +from components.adm.adm.views import adm
  11 +app.register_blueprint(adm, url_prefix='/adm')