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

Update project

parent 48201a87
......@@ -33,7 +33,7 @@ Logger:
Retention:
Scheduler:
Start: 2023-11-12 10:04:00
Start: 2023-11-12 12:08:00
End: 2099-11-11 16:00:00
Timezone: Asia/Shanghai
......
......@@ -13,3 +13,4 @@
from .config import ConfigHelper
from .env import EnvVarHelper
from .file import FileHelper
from .mysql import MySQLHelper
......@@ -14,6 +14,7 @@ import datetime
from application.extensions.init_sqlalchemy import db
from application.models import User
from application.common import global_config
from application.libs.helper import MySQLHelper
def task():
......@@ -23,9 +24,20 @@ def task():
:return: None
"""
with db.app.app_context():
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")
cfg = db.app.config.ExtraDB
options = {
"host": cfg.Host,
"user": cfg.User,
"password": cfg.Password,
"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