I've ported a website from a server to another few days ago. Now I need to complete the port, updating the database in the new server.
I've done it, but i get a strange error. It doesn't show me images.
In the database the image field contains https://www.domain.ext/media/uploads/homepage/image_name.jpg
but in the admin panel the url is not like that, is like MEDIA_URL
(set up in settings.py file) and image field from the database, so if MEDIA_URL
is set up like https://www.domain.ext/media/
, in the admin panel in the image field I'll see https://www.domain.ext/media/https://www.domain.ext/media/uploads/folder/image_name.jpg
.
I've tried to amend manually the link in db leaving only /uploads/folder/image_name.jpg
, I've refreshed the admin page and it seemed ok, but when I saved, it was another time in the wrong form.
Who is so kind to explain me why, and how I can manage with that?
EDIT:
Django Version is 1.2.5
Another issue i saw is that if there is http
in MEDIA_URL
the behaviour is the same as I have explained . If there is https
the url become /https:/www. ...etc...
.
For this latter, I tried to put an u
before the MEDIA_URL
string, like MEDIA_URL = u"text"
but it didn't work.
Finally i got the problem!
The problem was in the
filebrowser
module.In
filebrowser/functions.py
there is a method namedurl_join
that was defined like:I simply added an
s
where there ishttp
so now it'shttps
and it works. It writes the correct thing in the db and it also render the url in the correct way.Thanks to all for help! :)
EDIT:
Merry Christmas to all! :)