task.py 779 Bytes
Newer Older
崔为之's avatar
崔为之 committed
1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
# @Version     : Python 3.11.4
# @Software    : Sublime Text 4
# @Author      : StudentCWZ
# @Email       : StudentCWZ@outlook.com
# @Date        : 2023/11/7 16:16
# @File        : task.py
# @Description :
"""
崔为之's avatar
崔为之 committed
12

崔为之's avatar
崔为之 committed
13
import datetime
崔为之's avatar
崔为之 committed
14 15
from application.extensions.init_sqlalchemy import db
from application.models import User
崔为之's avatar
崔为之 committed
16
from application.common import global_config
崔为之's avatar
崔为之 committed
17

崔为之's avatar
崔为之 committed
18 19 20 21 22 23 24

def task():
    """
    Some Tasks.

    :return: None
    """
崔为之's avatar
崔为之 committed
25 26
    with db.app.app_context():
        print("create user")
崔为之's avatar
崔为之 committed
27 28 29
        user = User(username="CWzz", email="Stuu@outlook.com", password="qwe!2345", active=True,
                    created_at=datetime.datetime.utcnow())
        user.save()
崔为之's avatar
崔为之 committed
30
        print(db.app.config)
崔为之's avatar
崔为之 committed
31
        print("created user admin")