【问题标题】:Deploying Pyramid to dotcloud将 Pyramid 部署到 dotcloud
【发布时间】:2011-10-02 10:58:55
【问题描述】:

将 Pyramid 项目部署到 dotcloud 的正确方法是什么?

wsgi.py 的内容:

import os, sys
from paste.deploy import loadapp
current_dir = os.path.dirname(__file__)
application = loadapp('config:production.ini', relative_to=current_dir)

我目前收到以下错误。

uWSGI Error
wsgi application not found

【问题讨论】:

    标签: python pyramid wsgi dotcloud


    【解决方案1】:

    这可能表示wsgi.py 无法成功导入。

    您可以检查以下内容:

    • dotcloud logs appname.servicename 的输出
    • dotcloud ssh appname.servicename登录服务,然后进入current目录,启动python看看如果你尝试做from wsgi import application会发生什么

    如果有帮助,这里有一个超级简单的 Pyramid 应用程序: https://github.com/jpetazzo/pyramid-on-dotcloud

    【讨论】:

      【解决方案2】:

      我能够通过 uWSGI 错误错误使用:

      import os
      from paste.deploy import loadapp
      current_dir = os.getcwd()
      application = loadapp('config:production.ini', relative_to=current_dir)
      

      静态文件仍然存在路径问题,因此我进行了更改:

      config.add_static_view('static', 'static', cache_max_age=3600)
      

      config.add_static_view('<myapp>/static', 'static', cache_max_age=3600)
      

      【讨论】:

        【解决方案3】:

        试试这个:

        import os
        os.environ['DJANGO_SETTINGS_MODULE'] = 'hellodjango.settings'
        import django.core.handlers.wsgi
        application = django.core.handlers.wsgi.WSGIHandler()
        

        http://docs.dotcloud.com/tutorials/python/django/

        【讨论】:

        • 哎呀。我认为这不是您要寻找的答案。对不起。我没注意。干杯!
        猜你喜欢
        • 1970-01-01
        • 2023-03-15
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-07-12
        • 1970-01-01
        相关资源
        最近更新 更多