Skip to content

APPEND_SLASH #77

Description

@mountain-kangkang

RuntimeError: You called this URL via POST, but the URL doesn't end in a slash and you have APPEND_SLASH set. Django can't redirect to the slash URL while maintaining POST data. Change your form to point to api.desub.kr/api/user/g-phone/ (note the trailing slash), or set APPEND_SLASH=False in your Django settings.

이 에러는 Django의 URL 슬래시(/) 처리와 관련된 문제입니다. Django의 APPEND_SLASH 설정때문에 발생하는 것입니다.

  1. URL 끝에 슬래시(/)를 추가하여 요청
  2. settings.py에서 APPEND_SLASH 설정을 False로 변경
    APPEND_SLASH = False

문제 원인

  • Django는 기본적으로 URL 끝에 슬래시(/)를 붙이도록 설정되어 있습니다6.
  • POST/OPTIONS 요청의 경우 자동으로 슬래시를 추가한 URL로 리다이렉트할 수 없습니다(데이터가 손실될 수 있기 때문)3.

가장 권장되는 해결방법은 API 엔드포인트 URL 끝에 슬래시(/)를 추가하는 것입니다. 이는 Django의 URL 패턴 일관성을 유지하는데 도움이 됩니다.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions