Skip to content

Commit 03c7e39

Browse files
update with new architecture
1 parent e57a369 commit 03c7e39

13 files changed

+25
-13
lines changed

application.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
from flask_admin import Admin
66
from flask_admin.contrib.sqla import ModelView
77
from settings.extension import db, migrate, ma, swagger
8-
from AuthApp.router import AuthApp
9-
from AuthApp import models
8+
from apps.AuthApp.router import AuthApp, models
109

1110

1211
# Flask App initialize with extensions and run
@@ -17,9 +16,9 @@ def create_app():
1716

1817
# Flask Admin
1918
app.config['FLASK_ADMIN_SWATCH'] = 'cerulean'
20-
admin = Admin(app, name='microblog', template_mode='bootstrap3')
21-
admin.add_view(ModelView(models.User, db.session))
22-
admin.add_view(ModelView(models.EmailHandler, db.session))
19+
admin = Admin(app, name='Flask Admin Panel', template_mode='bootstrap4')
20+
admin.add_view(ModelView(models.User, db.session, category='Auth'))
21+
admin.add_view(ModelView(models.EmailHandler, db.session, category='Auth'))
2322

2423
# Blueprints
2524
app.register_blueprint(AuthApp, url_prefix='/auth')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

AuthApp/models.py renamed to apps/AuthApp/models.py

-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
from werkzeug.security import generate_password_hash
2-
32
from settings.extension import db, timestamp # Database Object SQLAlchemy
43

54

File renamed without changes.

AuthApp/module/auth.py renamed to apps/AuthApp/module/auth.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from flask import jsonify, request
2-
from AuthApp.models import User
2+
from apps.AuthApp.models import User
33
from functools import wraps
44
import jwt
55
import os
66
import datetime
77
from settings.extension import db
88
from werkzeug.security import check_password_hash, generate_password_hash
99
from settings.response import TokenType
10-
from AuthApp.module.email import EmailService
10+
from apps.AuthApp.module.email import EmailService
1111

1212
SECRET_KEY = os.environ.get('SECRET_KEY')
1313

AuthApp/module/email.py renamed to apps/AuthApp/module/email.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import datetime
2-
from AuthApp.models import EmailHandler
2+
from apps.AuthApp.models import EmailHandler
33
from settings.extension import db
44
from flask import render_template_string
55
import uuid

apps/AuthApp/query.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
def main():
2+
data = [
3+
{
4+
"category": "cat 1",
5+
"count": 2
6+
}
7+
]
8+
9+
test(data)
10+
11+
12+
13+
def test(data):
14+
for d in data:
15+
print(d)

AuthApp/router.py renamed to apps/AuthApp/router.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
from flask import Blueprint, Response, request
33
from flasgger.utils import swag_from
44
from settings.response import TokenType, StatusType, ResponseModal
5-
from AuthApp.schema import UserSchema, User
6-
from AuthApp.module.auth import RequiredAuthToken, GetJwtToken, createUser, loginUser
5+
from apps.AuthApp.schema import UserSchema, User
6+
from apps.AuthApp.module.auth import RequiredAuthToken, GetJwtToken, createUser, loginUser
77

88
# Initialize blueprint and register it with flask app
99
AuthApp = Blueprint('Auth App', __name__)

AuthApp/schema.py renamed to apps/AuthApp/schema.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
from AuthApp.models import User
1+
from apps.AuthApp.models import User
22
from settings.extension import ma
3-
from marshmallow.exceptions import ValidationError
43

54

65
# Create schemas for models
File renamed without changes.

0 commit comments

Comments
 (0)