Been using Red Hat OpenShift for 6-months now, but have been annoyed
with their lack of DNS. A or CNAMEs simply aren't the same.

So today I thought to try with Heroku.

Here's a step-by-step setup guide:

1. Follow these steps: https://devcenter.heroku.com/articles/quickstart
2. Grab the version of web2py you want to use (I used trunk off of
github), cd into this directory
3. echo web: python anyserver.py -s gunicorn -i 0.0.0.0 -p $PORT > Procfile
4. In this directory create a 'requirements.txt' file for pip, with
these contents:
web2py
gunicorn
psycopg2 # PostgreSQL
5. Modify the db.py for your app(s) to:
if not request.env.web2py_runtime_gae:
    ## if NOT running on Google App Engine use SQLite or other DB
    db = DAL('sqlite://storage.sqlite',pool_size=1,check_reserved=['all'])
    try: db = DAL(os.environ.get('DATABASE_URL'))
    except: db = DAL('sqlite://storage.sqlite')
6. git init && git add . && git commit -am "init"
7. heroku create
Take not of your URL here
8. git push heroku master

For further information see:
https://devcenter.heroku.com/articles/python
https://devcenter.heroku.com/articles/procfile
http://blog.doersguild.com/post/35049380409/running-web2py-on-heroku #
Where I got most of this from :P

My thoughts thus far:
- Good to see a newer version of python (2.7.2 vs OpenShifts': 2.6)
- Has a default AES256 bit protected DigiCert verified which is nice
to see; and stops me from doing any hacky workarounds to get admin
working on HTTP (like required with OpenShift)
- Don't need to enter my password everytime I push my changes (not
sure if I like this!)
- It uses an old version of pip (1.1)

Problems:
Unable to get a database connection. The doersguild blog guide which I
followed (see link above) didn't work, because 'DATABASE_URL' isn't in
my environ.

My environ contains:
{'LANG': 'en_US.UTF-8', 'LIBRARY_PATH': '/app/.heroku/vendor/lib',
'SHLVL': '1', 'PYTHONPATH': '/app/', 'SERVER_SOFTWARE':
'gunicorn/0.17.0', 'PYTHONHOME': '/app/.heroku/venv/', 'PORT': '[not
saying publicly]', 'PWD': '/app', 'PYTHONHASHSEED': '[not saying
publicly]', 'HOME': '/app', 'PATH':
'/app/.heroku/venv/bin:/app/.heroku/venv/bin:/bin:/usr/local/bin:/usr/bin',
'PYTHONUNBUFFERED': 'true', 'PS1':
'\\[\\033[01;34m\\]\\w\\[\\033[00m\\] \\[\\033[01;32m\\]$
\\[\\033[00m\\]', 'LD_LIBRARY_PATH': '/app/.heroku/vendor/lib', '_':
'/app/.heroku/venv/bin/python'}

Hope you enjoy my guide and can help me edit it to make it work
properly; i.e.: with DB connection.

All the best,

Alec Taylor

-- 



Reply via email to