Posted by Anderson Santos |
|
I am having problems about setting the "upload_to" param in WikiAttachment model.
I can't understand how it should be setted. I am using the 0.2 version due proxy issues for SVN, so I am not sure if it is already corrected. what the heck am I doing? |
|
Posted by Herbert Poul |
|
there should be no nead to modify the value ..
just make sure that your MEDIA_ROOT exists and contains a directory called 'var' which is writable by the webserver user .. (e.g. in debian user 'www-data') btw. what error do you receive for the upload ? Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Anderson Santos |
|
I just altered so I can remember the original path, but this is my actual settings:
###on settings.py MEDIA_ROOT = os.path.join(local_path, 'media') #it's working fine MEDIA_URL = 'http://www.agrotis.com/pmedia' ###on sphwiki models.py fileupload = models.FileField( upload_to = 'sphwiki/attachment/%Y/%m/%d' ) The link to the file on attachment list is http://www.agrotis.com/sphwiki/attachment/2007/08/14/images.jpeg if I add the /pmedia/ to the address, the file appears correctly Am I missing something? The full addr is: http://www.agrotis.com/sphwiki/attachment/2007/08/14/images.jpeg what the heck am I doing? |
|
Posted by Herbert Poul |
|
strange - you look at the URLs in the list of attachments ?
i don't think there was changed anything .. you could look into templates/sphene/sphwiki/listAttachments.html if it contains: {{ attachment.get_fileupload_url }} as far as i understand the django code.. this method always prefixes the path with the MEDIA_URL .. Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Anderson Santos |
|
hmmm, yes, it is probably something with django. I never used filefield in this site, just in another one, so I have to check. I thought you were using a different attachment-style implementation
But here a suggestion, a setting entry for upload file path. I wouldn't like to force a path like "/var/..." =) Thank you, again what the heck am I doing? |
|
Posted by Herbert Poul |
|
why not ? ... because you don't like /var/ in your URLs ? Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Anderson Santos |
|
yes, I would prefere to be flexible with the folder name for attachments
its prettier just an "attachment" folder or something then a directory-looking path also the formatting, in our case, it doesn't need to be the full datetime =P what the heck am I doing? |
|
Posted by Anderson Santos |
|
and yes, it was a django issue
a trailing slash missing on media_url MEDIA_URL = "http://www.agrotis.com/pmedia/" instead of (without the trailing slash) MEDIA_URL = "http://www.agrotis.com/pmedia" what the heck am I doing? |
|
Posted by Herbert Poul |
|
hmm ok .. i understand.. i think it is weird anyway that i have to define an upload path in a model .. this should be configuration ..
well .. maybe i can simply use an SPH_SETTINGS variable there .. shouldn't make too much problems Hey, we have Signatures !!! Great, isn't it ? ;) |
|
Posted by Anderson Santos |
|
Yes, that was what I thought. Just an entry on SPH_SETTINGS.
The only issue may be if someone change the settings and the wiki files will be in different foldes, but if the media root keep the same, it would be accessible anyway =D what the heck am I doing? |