gpt4 book ai didi

python - 夹层部署 Apache2 wsgi 时遇到错误

转载 作者:太空宇宙 更新时间:2023-11-04 06:21:23 25 4
gpt4 key购买 nike

我尝试了夹层,并对此感到兴奋。将其部署到 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 :

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管理员/@richard

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

我是这个领域的新手。我非常感谢您所做的所有努力。非常感谢!我希望我能采取下一步行动,请指导我详细了解您将要提及的所有内容(婴儿步骤)。提前致谢。

火狐浏览器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.3Python 路径:

['/home/webapp/test5/test5', '/home/webapp/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-08-12 23:33:21 +0800

最佳答案

尝试将此添加到您的 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>

关于python - 夹层部署 Apache2 wsgi 时遇到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11895185/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com