Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only set SERVERS for drf-spectacular in production #3609

Merged
merged 2 commits into from Dec 6, 2022
Merged

Only set SERVERS for drf-spectacular in production #3609

merged 2 commits into from Dec 6, 2022

Conversation

ghazi-git
Copy link
Contributor

it is removed from local settings since having the url as 127.0.0.1:8000 triggers a CORS issue when the project runs on localhost:8000. It is kept in production settings as that allows tools that generate code samples to point to the correct domain.

Description

Checklist:

  • I've made sure that tests are updated accordingly (especially if adding or updating a template option)
  • I've updated the documentation or confirm that my change doesn't require any updates

Rationale

Based on the comments in the issue, I thought it would be good to keep SERVERS in production settings so the original goal of adding it is met, but also thought it might not be useful in local settings (plus adding it requires setting CORS_ALLOWED_ORIGINS=["localhost:8000"])

fixes #3593

it is removed from local settings since having the url as 127.0.0.1:8000 triggers a CORS issue when the project runs on localhost:8000. It is kept in production settings as that allows tools that generate code samples to point to the correct domain.
Copy link
Member

@browniebroke browniebroke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@luzfcb do you want to give this a look before we merge it?

@browniebroke browniebroke merged commit fc081ce into cookiecutter:master Dec 6, 2022
@browniebroke browniebroke changed the title set SERVERS in production settings instead of base settings Set SERVERS for drf-spectacular in production only Dec 6, 2022
@browniebroke browniebroke changed the title Set SERVERS for drf-spectacular in production only Only set SERVERS for drf-spectacular in production Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API calls from Swagger UI page fail while running the project at "localhost:8000" due to CORS
2 participants