Hey everyone,
I encountered an issue at the production level Whenever I am trying to update/add a model that contains media files it shows error 13: Permission denied
- First I checked whether I have the read/write and update permission of the directory under the project and found that yes they do have the permission.
- I checked out the settings.py file but didn’t get anything wrong.
settings.py
MEDIA_URL = "/media/"
MEDIA_ROOT = BASE_DIR / "media"
STATIC_URL = "/static/"
STATIC_FILE_ROOT = BASE_DIR / "static"
STATICFILES_DIRS = ((BASE_DIR / "static"),)
STATIC_ROOT = BASE_DIR / "assets"
urls.py
urlpatterns = (
[
path("admin/", admin.site.urls),
path("", include("web.urls", namespace="web")),
path("", include("order.urls", namespace="order")),
path("main/", include("main.urls", namespace="main")),
path("product/", include("products.urls", namespace="product")),
path("accounts/", include("accounts.urls", namespace="accounts")),
path("accounts/", include("registration.backends.simple.urls")),
path(
"sitemap.xml",
TemplateView.as_view(template_name="sitemap.xml", content_type="text/xml"),
),
path(
"robots.txt",
TemplateView.as_view(template_name="robots.txt", content_type="text/plain"),
),
path(
"OneSignalSDKWorker.js",
TemplateView.as_view(
template_name="OneSignalSDKWorker.js", content_type="text/javascript"
),
),
]
+ static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
)
I know there are some issues with media files but I can’t figure it out.
It is working correctly in the local host