使用Apache2 wsgi在夹层部署期间遇到错误

时间:2012-08-10 03:45:38

标签: python django apache2

我尝试了夹层,并为此感到兴奋。将它部署到ubuntu服务器+ apache2 + mod_wsgi。 但我无法插入图像,无法看到浏览窗口。 当我尝试访问/ gallery /时,总是发生错误。 我是新人,绝望,请帮助。

WSGI.PY

import os, sys, site
sys.stdout = sys.stderr

# Add the virtual Python environment site-packages directory to the path
ve_path = '/home/webapp/richardeng/lib/python2.7/site-packages'
site.addsitedir(ve_path)

# put the Django project on sys.path
sys.path.insert(0, ve_path)
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), ".")))

# Avoid ``[Errno 13] Permission denied: '/var/www/.python-eggs'`` messages
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

from django.core.handlers.wsgi import WSGIHandler

HTTPD.CONF

WSGIScriptAlias / /home/webapp/richardeng/project/wsgi.py
WSGIPythonPath /home/webapp/richardeng/lib/python2.7/site-packages

Alias /static/ /home/webapp/richardeng/project/static/

<Directory /home/webapp/richardeng/project/static>
Order deny,allow
Allow from all
</Directory>

<Directory /home/webapp/richardeng/project>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

我使用了以下面料:

FABRIC = {
     "SSH_USER": "vagrant",  # SSH username
     "SSH_PASS":  "vagrant", # SSH password (consider key-based authentication)
     "SSH_KEY_PATH":  "", # Local path to SSH key file, for key-based auth
     "HOSTS": ["192.168.124.12", ], # List of hosts to deploy to
     "VIRTUALENV_HOME":  "/home/vagrant", # Absolute remote path for virtualenvs
     "PROJECT_NAME": "mymezz", # Unique identifier for project
     "REQUIREMENTS_PATH": "requirements/project.txt", # Path to pip requirements, relative to project
     "GUNICORN_PORT": 8000, # Port gunicorn will listen on
     "LOCALE": "en_US.UTF-8", # Should end with ".UTF-8"
     "LIVE_HOSTNAME": "192.168.124.12", # Host for public site.
     "REPO_URL": "git://github.com/nimbis/mezzanine-project.git", # Git or Mercurial remote repo URL for the project
     "DB_PASS": "password", # Live database password
     "ADMIN_PASS": "default", # Live admin user password
 }

我的网络测试失败:http://www.globalunicom.com admin / @ richard

我尝试直接在服务器上安装夹层。运行apache2服务器和mysql。 httpd.conf和wsgi.py保持不变。 遗憾的是/ gallery和admin无法实现上传图片。只有这一次,还有另一个问题如下。好像我不能使用一个缩略图

我是这个领域的新手。我非常感谢你所做的一切努力。非常感谢你! 我希望我可以采取下一步行动,并请向我提供有关您将要提及的所有内容的详细信息(宝贝步骤)。提前致谢。

Firefox浏览器 FileSystemEncodingChanged在/ gallery /

尝试在路径中包含unicode字符的文件上进行访问,但不知何故当前语言环境不支持utf-8。您可能需要将'LC_ALL'设置为正确的值,例如:'en_US.UTF-8'。

请求方法:GET 请求网址:http://www.globalunicom.com/gallery/ Django版本:1.4.1 异常类型:FileSystemEncodingChanged 例外值:

尝试在路径中包含unicode字符的文件上进行访问,但不知何故当前语言环境不支持utf-8。您可能需要将'LC_ALL'设置为正确的值,例如:'en_US.UTF-8'。

异常位置:/home/webapp/test5/lib/python2.7/site-packages/mezzanine/core/templatetags/mezzanine_tags.py缩略图,第244行 Python可执行文件:/ usr / bin / python Python版本:2.7.3 Python路径:

[ '/家/ web应用/ TEST5 / TEST5',  '/家/ web应用/ TEST5',  '/home/webapp/test5/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',  '/home/webapp/test5/lib/python2.7/site-packages/pip-1.1-py2.7.egg',  '/home/webapp/test5/lib/python2.7/site-packages',  '/usr/local/lib/python2.7/dist-packages/pip-1.1-py2.7.egg',  '/usr/lib/python2.7',  '/usr/lib/python2.7/plat-linux2',  '/usr/lib/python2.7/lib-tk',  '/usr/lib/python2.7/lib-old',  '/usr/lib/python2.7/lib-dynload',  '/usr/local/lib/python2.7/dist-packages',  '/usr/lib/python2.7/dist-packages',  '/usr/lib/pymodules/python2.7']

服务器时间:太阳,2012年8月12日23:33:21 +0800

1 个答案:

答案 0 :(得分:1)

尝试将此添加到您的http.conf

Alias /gallery /your/route/to/gallery/in/your/file/system

<Directory /your/route/to/gallery/in/your/file/system
Order deny,allow
Allow from all
</Directory>