Django CKEditor5 images not displaying on server
I am using Django 5.0 and django-ckeditor-5 to handle rich text stuff in my admin panel, including image uploading by staff. On my local machine (Win11), everything works fine. I can upload the image and it shows correctly in the admin view and in the site view.
However, when putting it on my test server (Windows Server 2022, using IIS), when I upload an image, it flashes and then displays the default broken image. Attempting to navigate to the image directly gives a 404, but when I look at the URL of the image and physically find it on the server, its there and I can open it in paint. So the images are uploading into the correct place, the URL of the image in CK editor is showing the correct image, but the image does not want to load.
Here is my path settings for the urls.py at the root and the media folder in settings.py
urls.py
...
urlpatterns += [
path("ckeditor5/", include('django_ckeditor_5.urls')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
settings.py
...
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/')
The setup is identical for both local and on the server in terms of folder structure, the media folder is in the same place in the directory. In IIS, I set the media folder as a virtual directory, just like I did for the static folder and it has inherited permissions so it should be able to access it. I just have no idea why its not working.
Thanks in advance!