0

I am trying to deploy a Django app on openshift (python3.3, django1.7, Openshift 2.1).

I need to set the OPENSHIFT_PYTHON_WSGI_APPLICATION to point to an alternative wsgi.py location.

I have tried using the pre_build script to set the variable, using the following commands:

export OPENSHIFT_PYTHON_WSGI_APPLICATION="$OPENSHIFT_REPO_DIR"geartest4/wsgi.py
echo "-------> $OPENSHIFT_PYTHON_WSGI_APPLICATION"

I can see during the git push that the pre_build script sets the variable correctly. The echo shows the correct path as expected. However wsgi.py does not launch and I get:

CLIENT_ERROR: WSGI application was not found

When I immediately ssh into the gear and check the environment variable I see that OPENSHIFT_PYTHON_WSGI_APPLICATION="" is not set.

If I set the variable manually from my workstation using rhc set-env OPENSHIFT_PYTHON_WSGI_APPLICATION=/var/lib/openshift/gear_name/bla/bla then the variable sticks, the wsgi server launches, and the app works fine.

The problem is that I don't want to use rhc set-env because that means I have to hardwire the gear name in the path. This becomes a problem when I want to do scaling with multiple gears.

Anyone have any ideas on how to set the variable and make stick?

4

1 回答 1

1

环境变量OPENSHIFT_PYTHON_WSGI_APPLICATION可以设置为这样的相对路径:

rhc env set OPENSHIFT_PYTHON_WSGI_APPLICATION=wsgi/wsgi.py

jfmatth 的 openshift 磁带openshift-django17 也使用了这种方法。

于 2015-02-16T10:36:22.497 回答