This commit is contained in:
2025-03-03 08:22:12 +08:00
parent 18c756ae0f
commit b2bd58f40e
2 changed files with 11 additions and 2 deletions

View File

@@ -7,6 +7,11 @@ from .models import User
router = Router() router = Router()
@router.get("/")
def account(request):
return {"message": "success"}
@router.post("/register") @router.post("/register")
def user_register(request, payload: UserRegistrationSchema): def user_register(request, payload: UserRegistrationSchema):
if User.objects.filter(username=payload.username).exists(): if User.objects.filter(username=payload.username).exists():

View File

@@ -21,7 +21,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret! # SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.getenv("SECRET_KEY") SECRET_KEY = os.environ.get("SECRET_KEY")
# SECURITY WARNING: don't run with debug turned on in production! # SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False DEBUG = False
@@ -130,5 +130,9 @@ DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
AUTH_USER_MODEL = "account.User" AUTH_USER_MODEL = "account.User"
CORS_ALLOWED_ORIGINS = ["http://localhost:8098", "https://web.xuyue.cc"] CORS_ALLOWED_ORIGINS = [
"http://localhost:3000",
"http://localhost:8081",
"https://web.xuyue.cc",
]
CORS_ALLOW_CREDENTIALS = True CORS_ALLOW_CREDENTIALS = True