Dear all,

After hours of research and testing, I would like to share my experience 
using pyenv + passenger wsgi + web2py on Dreamhost shared hosting as of 
08.2017

What I did differently than most guide online is that I only have to edit 
.htaccess file (in domain root folder) with:

Credit: ASO 
<https://help.asmallorange.com/index.php?/Knowledgebase/Article/View/316/9/creating-a-python-hello-world-application-with-flask-for-aso-shared-hosting>

PassengerEnabled on
PassengerAppRoot /home/%USER%/<your domain root folder>
PassengerPython /home/%USER%/.pyenv/shims/python

Most importantly and strangely, I didn't need to modify passenger_wsgi.py 
(handlers/wsgihandler.py) at all. Most guides online require adding two 
lines after `import os`, such as this one:

INTERP = "/home/<username>/local/bin/python" 
#INTERP is present twice so that the new Python interpreter knows the actual 
executable path 
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv)


But I couldn't make it work if I modify passenger_wsgi.py to specify pyenv 
enrivonment.

Some guides also suggest make a pyenv "virtualenv" within app folder, I found 
it is not required.

So this is what I did:

1. Enable passenger on Dreamhost panel. a folder 'public' will be created don't 
worry.
2. Put web2py into your domain root folder
3. cp handlers/wsgihandler.py passenger_wsgi.py
4. create/modify .htaccess in domain root folder as described above.
5. created tmp/ folder under my web root folder, did a "touch restart.txt" to 
get passenger to reload

Your web2py site should now load in your browser. If you use "Let's encrypt" 
from Dreamhost panel, you should be able to verify your python environment from 
admin interface by accessing https. I did verify mine.

I am not sure ssh tunnel method could serve as verification, because you are 
serving admin from a separate web2py instance running from your shell. 

Hope this will help future users. Thank all the people for providing web2py.

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to