|
|
Ssh to Oakley and then from there to apps-test.awesim.org (webtest04).
|
|
|
|
|
|
We use Software Collections. These versions of python are available:
|
|
|
|
|
|
```
|
|
|
efranz@webtest04:~$ scl --list | grep python
|
|
|
python27
|
|
|
rh-python35
|
|
|
```
|
|
|
|
|
|
To load this you can start a new bash session:
|
|
|
|
|
|
```
|
|
|
efranz@webtest04:~$ scl enable python27 -- bash
|
|
|
efranz@webtest04:~$ python --version
|
|
|
Python 2.7.8
|
|
|
```
|
|
|
|
|
|
Here is how to get the Passenger Flask python demo working under Open OnDemand. https://github.com/phusion/passenger-python-flask-demo. Ensure that the desired version of python is installed on the webhost.
|
|
|
|
|
|
|
|
|
1. Clone the repo and check out the end result branch:
|
|
|
|
|
|
```
|
|
|
cd ~/awesim/dev
|
|
|
efranz@webtest04:~/awesim/dev$ git clone git@github.com:phusion/passenger-python-flask-demo.git hellopython
|
|
|
Initialized empty Git repository in /users/PZS0562/efranz/awesim/dev/hellopython/.git/
|
|
|
remote: Counting objects: 18, done.
|
|
|
remote: Compressing objects: 100% (10/10), done.
|
|
|
remote: Total 18 (delta 5), reused 18 (delta 5), pack-reused 0
|
|
|
Receiving objects: 100% (18/18), 5.32 KiB, done.
|
|
|
Resolving deltas: 100% (5/5), done.
|
|
|
efranz@webtest04:~/awesim/dev$ cd hellopython
|
|
|
/users/PZS0562/efranz/awesim/dev/hellopython
|
|
|
efranz@webtest04:~/awesim/dev/hellopython (master)$ git checkout end_result
|
|
|
Branch end_result set up to track remote branch end_result from origin.
|
|
|
Switched to a new branch 'end_result'
|
|
|
```
|
|
|
|
|
|
* notice passenger_wsgi.py imports the app.py file; Passenger will load passenger_wsgi.py first
|
|
|
|
|
|
2. Create a `.pip` directory that will hold dependencies for this app, and install dependencies here:
|
|
|
|
|
|
```
|
|
|
efranz@webtest04:~/awesim/dev/hellopython (end_result)$ mkdir .pip
|
|
|
efranz@webtest04:~/awesim/dev/hellopython (end_result)$ export PYTHONPATH=./.pip:$PYTHONPATH
|
|
|
efranz@webtest04:~/awesim/dev/hellopython (end_result)$ pip install -t .pip flask
|
|
|
You are using pip version 7.1.0, however version 9.0.1 is available.
|
|
|
You should consider upgrading via the 'pip install --upgrade pip' command.
|
|
|
Collecting flask
|
|
|
Using cached Flask-0.12-py2.py3-none-any.whl
|
|
|
Collecting click>=2.0 (from flask)
|
|
|
Using cached click-6.7-py2.py3-none-any.whl
|
|
|
Collecting itsdangerous>=0.21 (from flask)
|
|
|
Collecting Werkzeug>=0.7 (from flask)
|
|
|
Using cached Werkzeug-0.11.15-py2.py3-none-any.whl
|
|
|
Collecting Jinja2>=2.4 (from flask)
|
|
|
Using cached Jinja2-2.9.5-py2.py3-none-any.whl
|
|
|
Collecting MarkupSafe>=0.23 (from Jinja2>=2.4->flask)
|
|
|
Installing collected packages: click, itsdangerous, Werkzeug, MarkupSafe, Jinja2, flask
|
|
|
Successfully installed Jinja2-2.6 MarkupSafe-0.11 Werkzeug-0.8.3 click flask itsdangerous
|
|
|
efranz@webtest04:~/awesim/dev/hellopython (end_result)$ python
|
|
|
Python 2.7.8 (default, Aug 4 2016, 09:29:33)
|
|
|
[GCC 4.4.7 20120313 (Red Hat 4.4.7-9)] on linux2
|
|
|
Type "help", "copyright", "credits" or "license" for more information.
|
|
|
>>> import flask
|
|
|
>>>
|
|
|
```
|
|
|
|
|
|
3. Add `bin/python` command which will be used to setup the environment
|
|
|
|
|
|
NGINX with Passenger is configured to execute `$APPROOT/bin/python` if this exists, so we can add environment modifications here. Following the example https://github.com/OSC/nginx_stage/blob/cc1398ed35214ed6bd774ffee93ad679e5f01cb0/bin/ood_ruby.example |
|
|
\ No newline at end of file |