feat: 完成多用户系统(登录/注册界面 + 用户隔离)

This commit is contained in:
maoshen
2026-04-15 03:02:54 +00:00
parent e6aecd2752
commit ae2a6d912f
8 changed files with 475 additions and 3 deletions

27
setup_auth_tables.py Normal file
View File

@@ -0,0 +1,27 @@
#!/usr/bin/env python3
"""
手动创建 auth 相关表
"""
import os, sys
sys.path.insert(0, '/root/.openclaw/workspace/diary-system/backend')
os.environ['DJANGO_SETTINGS_MODULE'] = 'diary_system.settings'
import django
django.setup()
from django.core.management import call_command
from django.db import connection
# 先迁移 auth 和 contenttypes
print("📦 创建 auth 相关表...")
call_command('migrate', 'contenttypes', '--run-syncdb')
call_command('migrate', 'auth', '--run-syncdb')
call_command('migrate', 'admin', '--run-syncdb')
call_command('migrate', 'sessions', '--run-syncdb')
print("✅ auth 表创建完成")
# 再运行 diary 迁移
print("\n📦 运行 diary 迁移...")
call_command('migrate', 'diary', '--run-syncdb')
print("✅ diary 迁移完成")