【问题标题】:Bootstrapping of Django 1.7 application to deploy on OpenShift在 OpenShift 上部署 Django 1.7 应用程序的引导
【发布时间】:2014-11-18 04:42:58
【问题描述】:

我想在 openshift 上部署 Django 1.7 应用程序。 我已经尝试过在 Deploying a local django app using openshift 但我得到了

503 服务不可用 没有可用于处理此请求的服务器。

错误信息。

谁能告诉我在 openshift 上部署 Django 1.7 应用程序的正确方法?

wsgi.py(由 Openshift 创建)包含以下代码

`

 import os

 virtenv = os.environ['OPENSHIFT_PYTHON_DIR'] + '/virtenv/'
 virtualenv = os.path.join(virtenv, 'bin/activate_this.py')
 try:
     execfile(virtualenv, dict(__file__=virtualenv))
 except IOError:
     pass
 # 
 #
 # IMPORTANT: Put any additional includes below this line.  If placed above this
 # line, it's possible required libraries won't be in your searchable path
 #
 from social.wsgi import application

` 目录结构是

.
|-- coleccioneselcomercio
|   |-- static
|   `-- templates
|-- manage.py
|-- network
|   |-- admin.py
|   |-- __init__.py
|   |-- models.py
|   |-- static
|   |   `-- network
|   |       `-- favicon.ico
|   |-- templates
|   |   `-- network
|   |       |-- index.html
|   |       |-- Login.html
|   |       `-- Signup.html
|   |-- tests.py
|   `-- views.py
|-- requirements.txt
|-- setup.py
|-- social
|   |-- app_Global.py
|   |-- __init__.py
|   |-- settings.py
|   |-- urls.py
|   `-- wsgi.py
|-- wsgi
|   `-- static
`-- wsgi.py

social/wsgi.py 是 django-admin 创建的默认 wsgi.py 它包含

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "social.settings")

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

我想问的另一件事是,由 openshift 创建的 wsgi.py 中的这段代码是做什么的,是应该保留在 wsgi.py 中还是应该将其注释掉?

if __name__ == '__main__':
    from wsgiref.simple_server import make_server
    httpd = make_server('localhost', 8051, application)
    # Wait for a single request, serve it and quit.
    httpd.handle_request()

【问题讨论】:

  • 您可能需要发布一些源代码以供我们帮助!
  • 我已经编辑了帖子。你能帮帮我吗?如果我需要发布任何其他代码,请告诉我。

标签: python django openshift


【解决方案1】:

我没有找到正确且清晰的 Openshift django 应用程序引导和设置说明。

从这两个链接

Deploying a local django app using openshift

https://github.com/jfmatth/openshift-django17

我找到了在 Openshift 上部署 Django1.7 应用程序所需的正确目录结构和设置。

我编写了这个脚本来引导 Openshift 的 Django 应用程序

https://github.com/girish946/Power-Django-Openshift

现在它对我来说很好。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-14
    • 1970-01-01
    • 2017-12-24
    • 1970-01-01
    • 2015-01-08
    相关资源
    最近更新 更多