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

Media isn't working locally when DEBUG is turned off #151

Open
g-londhe opened this issue May 30, 2022 · 7 comments
Open

Media isn't working locally when DEBUG is turned off #151

g-londhe opened this issue May 30, 2022 · 7 comments

Comments

@g-londhe
Copy link

g-londhe commented May 30, 2022

How do I configure the saleor locally when DEBUG is off?

I made the following changes,

Generated and added secret_key and RSA_key in backend.env

Added the following variables to the API service

- API_URI=http://localhost:8000/graphql/
- DASHBOARD_URL=http://localhost:9000
- STOREFRONT_URL=http://localhost:3001
- ALLOWED_HOSTS=localhost,api
- ALLOWED_CLIENT_HOSTS=localhost,api
- DEBUG=False
- ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL=False

Outcome:

localhost:8000 stopped working, while localhost:8000/graphql is working fine.
Unable to see the media uploaded as a path to the media upload is localhost:8000
I have set up a saleor using the steps mentioned here -> https://saleor.io/open-source/

Kindly advise to make it work with docker-compose and DEBUG off.

Saleor version -> 3.2.0

@manojLondhe
Copy link

I observed same thing- with debug off, media URLs are broken

@g-londhe
Copy link
Author

g-londhe commented Jun 1, 2022

Can someone help me with this?

@manojLondhe
Copy link

bump...

@chrislais
Copy link

What I know is that static assets are not processed when django sets debug to false

@patrys
Copy link
Member

patrys commented Dec 12, 2022

It’s the expected behavior, serving assets is a convenience feature for local development. With DEBUG disabled, you’re responsible for serving the media files. Performance-wise, it does not make sense to use the GraphQL server to serve static assets. Please use Nginx, CloudFront, or any other CDN.

@patrys patrys closed this as completed Dec 12, 2022
@patrys patrys reopened this Dec 12, 2022
@patrys
Copy link
Member

patrys commented Dec 12, 2022

Sorry, I just realized it’s about the platform repository. This is in fact unexpected and something we need to fix.

@phwoelfel
Copy link

Is there a plan to fix this issue from over a year ago or is it still recommended to host this externally?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants