WebFaction
Community site: login faq

This is a cross post from this question on SO.

I am trying to open and write to a file from a view in django using f = open(os.path.join(settings.MEDIA_URL, 'file.txt'), 'w').

I am able to able to open and write to the file from manage.py shell but when running on webfaction the command above gives the error "[Errno 13] Permission denied: '/media/file.txt'".

Because I am able to access the file from the python shell I was thinking it might be an issue with the WSGI script or the apache settings on webfaction. Any suggestions?

asked 07 Nov '11, 16:28

DanielN
323
accept rate: 0%


Are you maybe wanting to use MEDIA_ROOT instead of MEDIA_URL?

permanent link

answered 07 Nov '11, 16:54

bmeyer71 ♦♦
1.5k3613
accept rate: 33%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×909
×64
×62
×2

question asked: 07 Nov '11, 16:28

question was seen: 4,580 times

last updated: 08 Nov '11, 16:02

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM