上传python的mezzanine项目到SAE不成功(反馈SAE客服解决)

给管理员的邮件如下:

管理员,您好:

我想把python的mezzanine项目部署到sae一直不成功,请求帮忙排查下。Django的版本是1.8.7,mezzanine的版本是4.0.1,python版本是2.7.10,我在本地运行没有问题是正常的,正常浏览,可是上传到了sae就不行了。我看完了所有可以Google到的在sae部署mezzanine的资料,但是还是找不到解决方法,不知道哪里配置错了,请管理员帮忙看下,谢谢了!

恳请帮忙排查下原因,这个问题纠结我好长时间了,我打算写一个个人的项目到sae,云豆也已经买了,现在就是上传不成功….百忙之中帮看下呀…

应用地址:http://siaswg.sinaapp.com

一直报错,如下:

Traceback (most recent call last):
  File "/data1/www/htdocs/571/siaswg/1/index.wsgi", line 2, in <module>
    from project_mezzanine import wsgi
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/wsgi.py", line 18, in <module>
    application = get_wsgi_application()
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/django/core/wsgi.py", line 14, in get_wsgi_application
    django.setup()
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/django/__init__.py", line 17, in setup
    configure_logging(settings.LOGGING_CONFIG, settings.LOGGING)
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/django/conf/__init__.py", line 48, in __getattr__
    self._setup(name)
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/django/conf/__init__.py", line 44, in _setup
    self._wrapped = Settings(settings_module)
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/django/conf/__init__.py", line 92, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/usr/local/sae/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/settings.py", line 321, in <module>
    set_dynamic_settings(globals())
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/mezzanine/utils/conf.py", line 48, in set_dynamic_settings
    add_to_builtins("mezzanine.template.loader_tags")
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/django/template/base.py", line 1407, in add_to_builtins
    builtins.append(import_library(module))
  File "/data1/www/htdocs/571/siaswg/1/project_mezzanine/../site-packages/django/template/base.py", line 1343, in import_library
    (taglib_module, e))
InvalidTemplateLibrary: ImportError raised loading mezzanine.template.loader_tags: cannot import name check_output

下面是我部署时的步骤和参考的资料:

一:把mezzanine需要所有的包直接下载下来然后复制到svn的版本库里(包含了django包)

virtualenv mysite
cd mysite/
source bin/activate
pip install mezzanine
cp -aR lib/python2.7/site-packages /Users/budong/Downloads/code_test/siaswg/1/

二:修改配置文件

cat index.wsgi

import sae
from project_mezzanine import wsgi
application = sae.create_wsgi_app(wsgi.application)

cat config.yaml

libraries:
- name: "django"
  version: "1.8.7"

handlers:
- url: /static
  static_dir: static

cat manage.py

#!/usr/bin/env python
import os
import sys

if __name__ == "__main__":
    os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_mezzanine.settings")
    from django.core.management import execute_from_command_line
    execute_from_command_line(sys.argv)

cat project_mezzanine/wsgi.py

"""
WSGI config for project_mezzanine project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/
"""

import os
import sys

root = os.path.dirname(__file__)
sys.path.insert(0, os.path.join(root, '..','site-packages') )
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "project_mezzanine.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

参考资料:

http://blog.csdn.net/a359680405/article/details/43113039

http://lrqrun.org/blog/29/sae

http://lincolnge.github.io/programming/2013/10/13/mac-configure-sae-mezzanine/

http://www.youlige.com/?p=49

http://blog.csdn.net/wklken/article/details/7629120


没想到SAE的客服回复还是很快的,解决速度也很快,赞一个,如下:

好的,尽快帮您解决 2015-12-09 10:15:32 客服(ID:9)

你好,这个我们确认一下,不确定这样直接copy的方式是否能直接这么使用。 2015-12-10 13:44:32 客服(ID:207080)

你好,这个是我们修改的subprocess缺少check_output这个函数导致的,正在修复中。 2015-12-10 15:03:10 客服(ID:207080)

好的,非常感谢,希望可以早点解决。 2015-12-10 15:26:14 用户(ID:640442)

你好,已经升级,麻烦检查现在是否还有问题。

另外,第三方包建议使用这里说的方法,http://www.sinacloud.com/doc/sae/python/tools.html#tian-jia-di-san-fang-yi-lai-bao不要直接拷贝。 2015-12-10 16:16:45 客服(ID:207080)

非常感谢,问题已经解决,网站正常访问了。 2015-12-12 09:07:33 用户(ID:640442)