Hi there,

I am using a FileField to store user-uploaded files on the server. My
setup works with the development server but raises a
SuspiciousOperation error when I switch to apache2. I spent hours
trying to figure out what's going wrong but I am running out of ideas
now ...

settings.py:
MEDIA_ROOT = '/var/www/static/'
MEDIA_URL = '/static/'
...

/etc/apache2/httpd.conf:
<Location "/">
    SetHandler python-program
    PythonHandler django.core.handlers.modpython
    SetEnv DJANGO_SETTINGS_MODULE brickit.settings
    PythonDebug On
    PythonOption django.root
    PythonPath "['/home/raik/data/py'] + sys.path"
</location>
<location "/media">
    SetHandler None
</location>
<location "/static">
    SetHandler None
</location>

The error occurs in /home/raik/data/py/django/core/files/storage.py in
path, line 207
(example: Attempted access to 'sequencing/traces/2009/01/rg150708-12b-
BBVF2.scf' denied.)

The django code raising the error looks un-suspicious enough ;)

    def path(self, name):
        try:
            path = safe_join(self.location, name)
        except ValueError:
            raise SuspiciousOperation("Attempted access to '%s'
denied." % name)
        return os.path.normpath(path)

The problem seems to be the value of self.location:
In the development server, self.location points to MEDIA_ROOT '/var/
www/static' as expected. Yet, in the apache process, self.location
points to an empty string "". The debug output tells me that
settings.MEDIA_ROOT is the same with the development and the apache
setup.

I am pretty lost at this one. Any help is greatly appreciated...
Greetings,
Raik


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to