Closed GoogleCodeExporter closed 9 years ago
MEDIA_URL needs to be the public path to the location defined in MEDIA_ROOT. It
sounds like your MEDIA_URL is "www.mysite.com" and needs to be
"www.mysite.com/media".
- Justin
Original comment by justin.d...@gmail.com
on 21 Mar 2008 at 12:33
I thought to double check,
Quoted from my settings.py
MEDIA_ROOT = '/var/www/mydomain.com/public/media/'
MEDIA_URL = 'http://mydomain.com/media'
Original comment by lilxviet...@gmail.com
on 21 Mar 2008 at 5:29
Are those the settings that are NOT working? Or did you get it fixed?
Original comment by justin.d...@gmail.com
on 21 Mar 2008 at 5:40
Not working.
I have to use:
PHOTOLOGUE_DIR = "media/photologue"
For it to work properly
Original comment by lilxviet...@gmail.com
on 21 Mar 2008 at 6:00
It should be:
MEDIA_ROOT = '/var/www/mydomain.com/public/media/'
MEDIA_URL = 'http://mydomain.com/media/'
Original comment by remigi...@gmail.com
on 23 Mar 2008 at 9:07
I replied to the issue notification last week but I don't think this was posted:
1. Can you upload photos and where are they being saved (the path)
2. if you copy a file to /var/www/mydomain.com/public/media/ is it viewable
from
http://www.mydomain.com/media/?
3. Why are you symlinking /public/media back to /public? Or have I
misunderstood?
Original comment by justin.d...@gmail.com
on 23 Mar 2008 at 9:24
1. Uploads goto /var/www/mydomain.com/public/photologue/photos/...
2. If something is in /public/media/ it is viewable from domain.com/media.
3. The symlink is there for nginx (If I do a location /media/ and set the root
to
/var/www/mydomain.com/public/, nginx will append a media/ folder).
Original comment by lilxviet...@gmail.com
on 24 Mar 2008 at 7:52
What happens if you set your MEDIA_ROOT to 'var/www/mydomain.com/public/'. It
sounds
to me like the symlink is creating a loop (I'm not on a *nix box right now to
try it
out).
Original comment by justin.d...@gmail.com
on 24 Mar 2008 at 8:05
Ok, scratch that. Create a new file called test.txt in the public folder and
then
open a python in your terminal and try this:
import os
print os.path.dirname('/var/www/mydomain.com/public/media/test.txt')
My guess is that it returns /var/www/mydomain.com/public/ instead of
/var/www/mydomain.com/public/media/. That would cause your issue as Photologue
uses
os.path.dirname to get the parent folder of your image files to determine the
path to
the cache directory and the because the file ISN'T actually in /media dirname is
returning the "wrong" directory...
Why not just use a "real" media directory under public?
Original comment by justin.d...@gmail.com
on 24 Mar 2008 at 8:13
>>> import os
>>> print os.path.dirname('/var/www/mydomain.com/public/media/test.txt')
/var/www/mydomain.com/public/media
Interesting right?
Unfortunately for both of us, based on laziness, the main reason that the
symlink is
there is because I didn't feel like moving/navigating through media every
single time
I need to edit a file. I guess I could've set it up so that i could rename
'public'
to 'media' and point my nginx /media/ root to /var/www/mydomain.com/. It's
something
to think about next time when setting up a django project with nginx.
I wanted to repeat that I did find a solution by prepending 'media' to the
photologue_dir setting. With that, this issue was created just to see how
photologue
gets its directory in case others could not find a solution to a problem like
this.
Original comment by lilxviet...@gmail.com
on 24 Mar 2008 at 9:24
Well if this is working for you, I'm just going to mark this won't-fix.
Original comment by justin.d...@gmail.com
on 26 Mar 2008 at 11:33
I am having a very similar problem.
MEDIA_ROOT = '/home/wsd/webapps/django/wsd/assets'
MEDIA_URL='http://mydomain.com/assets'
File upload works fine, and I can access the uploaded images (e.g.
http://mydomain.com/assets/photologue/photos/2008/Apr/27/cache/test.jpg) but
generated urls to the images do not include the 'assets' portion of MEDIA_URL
(e.g.
http://mydomain.com/photologue/photos/2008/Apr/27/cache/test.jpg).
>>> import os
>>> print os.path.dirname('/home/wsd/webapps/django/wsd/assets/test.txt')
/home/wsd/webapps/django/wsd/assets
I tried the solution proposed by lilxvietxboi, but when I prepend 'assets' to
PHOTOLOGUE_DIR setting, files were saved with nested 'assets' dirs
('/home/wsd/webapps/django/wsd/assets/assets/...') and the generated urls only
had a
single 'assets' in the path, so image tags still broken.
I am using webfaction hosting, if that helps at all. Any suggestions would be
appreciated.
Original comment by chris.em...@gmail.com
on 28 Apr 2008 at 3:57
Original issue reported on code.google.com by
lilxviet...@gmail.com
on 20 Mar 2008 at 5:58