new
This commit is contained in:
@@ -7,9 +7,14 @@ django.setup()
|
||||
from shop.models import ESP32Config
|
||||
|
||||
def populate():
|
||||
# 检查数据库是否已有数据,如果有则跳过,避免每次构建都重置
|
||||
if ESP32Config.objects.exists():
|
||||
print("ESP32Config data already exists, skipping population.")
|
||||
return
|
||||
|
||||
# 清除旧数据,避免重复累积
|
||||
# 注意:在生产环境中慎用 delete
|
||||
ESP32Config.objects.all().delete()
|
||||
# ESP32Config.objects.all().delete()
|
||||
|
||||
configs = [
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user