import datetime, random
from datetime import timedelta
from info import *

def add_test_users():
    app = create_app('Develop')
    users = []
    now = datetime.now()
    for num in range(0, 10000):
        try:
            user = User()
            user.nick_name = "%011d" % num
            user.mobile = "%011d" % num
            user.password_hash = "<PASSWORD>"
            user.last_login = now - timedelta(seconds=random.randint(0, 2678400))
            users.append(user)
            print(user.mobile)
        except Exception as e:
            print(e)
    with app.app_context():
        db.session.add_all(users)
        db.session.commit()
    print('ok')

add_test_users()
import datetime, random
from datetime import timedelta
from info import *

def add_test_users():
    app = create_app('Develop')
    users = []
    now = datetime.now()
    for num in range(0, 10000):
        try:
            user = User()
            user.nick_name = "%011d" % num
            user.mobile = "%011d" % num
            user.password_hash = "<PASSWORD>"
            user.last_login = now - timedelta(seconds=random.randint(0, 2678400))
            users.append(user)
            print(user.mobile)
        except Exception as e:
            print(e)
    with app.app_context():
        db.session.add_all(users)
        db.session.commit()
    print('ok')

add_test_users()