Strange django media deployment issue - django

I managed to deploy cherokee as a reverse proxy for a django app running with cherrypy as information source.
All of the static files and media files seem to be served correctly except for a particular image.
On http://mydomain.com/media/files/none.png, I get a
The image "http://mydomain.com/media/files/none.png" cannot be displayed because it contains errors.
But if I append a ? behind that file's url, it shows up correctly as a 1x1 pixel image.
http://mydomain.com/media/files/none.png?
will give
none.png (PNG Image, 1 x 1 pixels)
which is expected and correct.
Why is this so?

Browser cache problem. Issue solved a while back. Closing this.

Related

How to fix the error: 'This XML file does not appear to have any style information associated with it'

I hosted a small django project on virtual machine on digital ocean. Before I started using digital ocean to serve static files everything worked fine. But immediately I created a storage space and push my static files there the static files are not being served on the webpage, including django admin page (the project pages are showing net::ERR_ABORTED 403 (Forbidden). I have already installed django_storages and boto3.
I got some hint as to the possible cause of the problem when I clicked on digital ocean aws bucket url that looks like https://django-space-storage.nyc3.digitaloceanspaces.com. When I cliked on it I got the following error:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
It seems the browser is rendering my django pages as xml instead of html. I might be wrong with this assumption because I'm finding a hard time trying to understand what is actually going on. My question is, how do I cause the browser to render my django pages as html instead of xml?

DJANGO Static Image deletion

I am experiencing an issue with images saved in the static/images directory in Django. My website was rendering images appropriately, by referencing the name of the image e.g., Image_1. However, once I've tried to delete this image and include a new one in the static/images directory with the same name, Image_1, the website keeps rendering the old image. New images added in the same directory with new names are rendered without issues.
Since then I have specified all STATIC_ROOT, MEDIA and MEDIA_ROOT routes in settings.py, I have run manage.py collectstatic and I have checked the images stored in these directories. The "old" version of Image_1 is not there anymore, but the new one is, and the website still renders the "old" version of it.
Does anybody have an explanation for this, and how to fix it?
Thanks in advance!
Try reset your browser cache "ctrl + f5"
The browser has cached the old image in the PC of browser side .
Close the Page and clear the cache files of the browser,then try again.

Python Flask app on EC2 AWS, host by apache2

I'm trying to build a Flask APP, which includes two webpages. The first one allows users to upload an image, after which the server will take the image input and make predictions from CNN and generate some image results. For the first page and from the server end, they both work well. The user upload and image generation are successful. However, the second page won't load the newly generated images. The page shows as bellow:
The second webpage
Two issues could be possibly related to this:
Permission issue? I set the permission of this app folder and subfolders to 777, although the uploaded images and newly generated images are not. Please see the below image for details of these image permissions.
ls -la for all images to be shown
Even The pink ones are either uploaded(the first one) or newly generated (the rest two), while green ones are "shutil" copied from another folder. As green images inherit the previous permissions, it should display, but why does it not?
BTW, I also tried the solution here, but it still doesn't work.
Am I on the right track to solve this? Thanks in advance for any help.
Yanyang
Have you inspected to validate that the image path its using as the src is correct? This would be your first step to validate the application is correct.
After that try validating any error logs that may indicate a local file error, this would depend on the web server software you're using.

Image URL doesn't retrieve image

I load an image to my server side in django-admin with ImageField.
My server is deployed to Heroku.
I browse a .png image and search his path, I received it properly.
After couple of minutes, the server doesn't retrieve the image.
In the server logs, I get status 200 or 301, in both cases I don't get the image.
Anyone have any idea to help me find a way to fix this situation?
EDIT:
I find out that it occur because of an IOError after reading the image file.
It is happening with two files from a total of three (the third one is .png and is showing properly and his size is a bit smaller) I think it means, it won't always happend and there is no problem with the path because of it.
EDIT 2:
The way I thought i solved it, didn't worked.
any other idea?
As Fian mentioned in the comments:
There is high chance that there is something wrong with paths. Please
add your MEDIA_URL, MEDIA_ROOT, ImageField code from model and
serializer and image-url that is passed by your server to browser.
What I believe was the problem is, Heroku auto collectstatic to my staticfiles directory.
When I uploaded an image, I had no MEDIA_ROOT and MEDIA_URL settings.
Because of this, every image I uploaded was saved in the BASE_ROOT temporary and I had access to him.
Once in a while Heroku collectstatic my files to my static directory and I lost my connection to those files because of it. I was searching for those files in my BASE_DIR and they have been moved to the staticfiles directory.

Sitecore - not publishing media library

We are using Sitecore 6.5 and have a multi-site Sitecore solution (with lots of library code we have inherited)
Publishing the Media Library by item from Staging to Production but we are not seeing the image on the web.
The images are in the web database and the path to the images in the web site is good.
Error we are getting when the file is requested (same in browser window address bar) is http://domainname/error?aspxerrorpath=/~/media/OSS/Images/WaterAndWildlife/myimage.jpg.
There is no media prefix in the web.config
Any idea?
....Looking into it now but site is going live tomorrow so help very appreciated! Help!!
We faced a similar problem when, in production, media files were not published which resulted in 404 errors.
Solution: The problem was that media files were not saved to the database because a file path was provided with the Sitecore media files while uploading.
So the images were saved on the file system instead of in the database. But based on our web.config configuration we were fetching images from the database.
If you are facing a similar issue, just download the media image, remove the file path, and save it. Then re-upload the same image, save and publish the image.
Hope your problem will be solved.
One question, are these staging and production environments separate code files? if they are, what is the setting in your web.config for the settigns UploadAsFiles? because if that's true it will store them on server and the images will be on staging but not on prod. But usually if this setting is true and the files are getting stored in file system, specially in CM/CD environment it should push the physical files on publish as well, but sometime there might be other issues going on like permission etc..... and the files cant get to the destination.
"<setting name="Media.UploadAsFiles" value="false">"