apache + mod_wsgi与pyramid& pyramid_beaker的文件权限问题

时间:2012-04-17 08:14:49

标签: amazon-ec2 mod-wsgi file-permissions pyramid beaker

我正在尝试设置金字塔应用。我正在使用wsgi和apache2。

我一直收到内部服务器错误,并且apache日志的内容是

 mod_wsgi (pid=11200): Exception occurred processing WSGI script '/home/ubuntu/modwsgi/env/pyramid.wsgi'.
 Traceback (most recent call last):
   File "/home/ubuntu/modwsgi/env/lib/python2.6/site-packages/pyramid-1.3-py2.6.egg/pyramid/router.py", line 191, in __call__
     request._process_response_callbacks(response)
   File "/home/ubuntu/modwsgi/env/lib/python2.6/site-packages/pyramid-1.3-py2.6.egg/pyramid/request.py", line 243, in _process_response_callbacks
     callback(self, response)
   File "/home/ubuntu/modwsgi/env/lib/python2.6/site-packages/pyramid_beaker-0.6.1-py2.6.egg/pyramid_beaker/__init__.py", line 26, in session_callback
     self.persist()
   File "/home/ubuntu/modwsgi/env/lib/python2.6/site-packages/Beaker-1.6.3-py2.6.egg/beaker/session.py", line 706, in persist
     self._session().save()
   File "/home/ubuntu/modwsgi/env/lib/python2.6/site-packages/Beaker-1.6.3-py2.6.egg/beaker/session.py", line 400, in save
     **self.namespace_args)
   File "/home/ubuntu/modwsgi/env/lib/python2.6/site-packages/Beaker-1.6.3-py2.6.egg/beaker/container.py", line 622, in __init__
     util.verify_directory(self.file_dir)
   File "/home/ubuntu/modwsgi/env/lib/python2.6/site-packages/Beaker-1.6.3-py2.6.egg/beaker/util.py", line 85, in verify_directory
     os.makedirs(dir)
   File "/usr/lib/python2.6/os.py", line 150, in makedirs
     makedirs(head, mode)
   File "/usr/lib/python2.6/os.py", line 157, in makedirs
     mkdir(name, mode)
 OSError: [Errno 13] Permission denied: 'beaker_dir'

我可以使用简单的pserve来提供页面并在终端上运行wget http://localhost:6543/user/form。它适用于下载表单。但是在浏览器中我得到500错误。

我正在使用EC2来托管该应用。

在app:main节中我使用以下代码:

session.type = file
session.data_dir = beaker_dir
session.key = mvc
session.encrypt_key = mysecretencryptionkey
session.validate_key = mysecretvalidationkey
session.cookie_on_exception = true

非常感谢您的阅读

1 个答案:

答案 0 :(得分:3)

提供绝对路径:

session.data_dir = beaker_dir

当前的工作目录可以是任何东西,通常是'/',因此路径是错误的。