Reputation: 548
I recently had to drop the Django development server and moved to apache because of some problems with the html5 video tag.
The change brought a [Errno 13] Permission denied error when trying to upload a video to the media folder.
I have already set the media folder recursively to 777 with chmod and gave permissions to www-data group with chgrp; here is the output when executing ls -lha media/
total 12K
drwxrwxrwx 3 esteban www-data 4,0K 2012-02-22 06:44 .
drwxr-xr-x 10 esteban esteban 4,0K 2012-02-22 07:35 ..
drwxrwxrwx 3 esteban www-data 4,0K 2012-02-13 10:12 generated
I also wrote the following directive in the httpd.conf file:
<Directory /home/esteban/python_projects/video_transform/media>
Options +Indexes
Order allow,deny
Allow from all
</Directory>
This allows me to list the folder contents when browsing to http://localhost/media
but no success with the uploads yet.
Any ideas??
EDIT: The exception is thrown in this line:
destination = open('media/' + filename, 'wb+')
Upvotes: 1
Views: 2697
Reputation: 58533
Use an absolute path as suggested in comment. Read the documentation at:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Application_Working_Directory
as to why.
Upvotes: 4
Reputation: 3
I would test switching the Order directive in your Apache config. In the current case the deny directive, though not explicitly defined, comes after the Allow directive and effectively blocks all traffic. Switching the Order directive around as such should fix the issue:
<Directory /home/esteban/python_projects/video_transform/media>
Options +Indexes
Order deny,allow
Allow from all
</Directory>
Upvotes: 0