saleor / saleor-platform

All Saleor services started from a single repository with docker-compose.
BSD 3-Clause "New" or "Revised" License
652 stars 889 forks source link

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

Open g-londhe opened 2 years ago

g-londhe commented 2 years ago

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 commented 2 years ago

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

g-londhe commented 2 years ago

Can someone help me with this?

manojLondhe commented 2 years ago

bump...

chrislais commented 2 years ago

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

patrys commented 1 year ago

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 commented 1 year ago

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

phwoelfel commented 8 months ago

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