def get_now_time():
"""获取当前时间"""
from django.utils import timezone
import pytz
tz = pytz.timezone('Asia/Shanghai')
# 返回时间格式的字符串
now_time = timezone.now().astimezone(tz=tz)
now_time_str = now_time.strftime("%Y.%m.%d %H:%M:%S")
# 返回datetime格式的时间
now_time = timezone.now().astimezone(tz=tz).strftime("%Y-%m-%d %H:%M:%S")
now = datetime.datetime.strptime(now_time, '%Y-%m-%d %H:%M:%S')
return now_time_str