Commit 1c14fa79 authored by 崔为之's avatar 崔为之 💪🏽

Update project

parent 48201a87
...@@ -33,7 +33,7 @@ Logger: ...@@ -33,7 +33,7 @@ Logger:
Retention: Retention:
Scheduler: Scheduler:
Start: 2023-11-12 10:04:00 Start: 2023-11-12 12:08:00
End: 2099-11-11 16:00:00 End: 2099-11-11 16:00:00
Timezone: Asia/Shanghai Timezone: Asia/Shanghai
......
...@@ -13,3 +13,4 @@ ...@@ -13,3 +13,4 @@
from .config import ConfigHelper from .config import ConfigHelper
from .env import EnvVarHelper from .env import EnvVarHelper
from .file import FileHelper from .file import FileHelper
from .mysql import MySQLHelper
...@@ -14,6 +14,7 @@ import datetime ...@@ -14,6 +14,7 @@ import datetime
from application.extensions.init_sqlalchemy import db from application.extensions.init_sqlalchemy import db
from application.models import User from application.models import User
from application.common import global_config from application.common import global_config
from application.libs.helper import MySQLHelper
def task(): def task():
...@@ -23,9 +24,20 @@ def task(): ...@@ -23,9 +24,20 @@ def task():
:return: None :return: None
""" """
with db.app.app_context(): with db.app.app_context():
print("create user") cfg = db.app.config.ExtraDB
user = User(username="CWzz", email="Stuu@outlook.com", password="qwe!2345", active=True, options = {
created_at=datetime.datetime.utcnow()) "host": cfg.Host,
user.save() "user": cfg.User,
print(db.app.config) "password": cfg.Password,
print("created user admin") "database": cfg.DB,
"port": cfg.Port,
}
with MySQLHelper(**options) as helper:
print(helper.execute(cfg.Sql))
print("create user")
# user = User(username="CWzz", email="Stuu@outlook.com", password="qwe!2345", active=True,
# created_at=datetime.datetime.utcnow())
# user.save()
print(db.app.config)
print("created user admin")
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment