FYI (from web2py-developers)

Hello everybody,

At PyCon Argentina I met Craig Kerstiens from Heroku. He explained to me 
how heroku works and we were able to make web2py work on heroku.

This is still experimental and I will continue tweak it but you may want to 
give it a try and share your suggestions for improvement:


HOWTO:

1) get a heroku account and SDK (it is all free)

2) download web2py from google code (not from github because you do not 
want the .git folder)

   hg clone https://massimo.dipie...@code.google.com/p/web2py/

   cd web2py

3) install your web2py apps

4) in each app, replace

   db=DAL(…)

with

   from gluon.contrib.heroku import get_db 
                                        

   db = get_db() 

5) from inside the web2py folder do (this create a git repo, if you have 
one, delete it):

   scripts/setup-web2py-heroku.sh

Now should have your apps running on heroku with postgresql.

caveats:

get_db()  gives you a postgresql connection on heroku and stores sessions, 
migrations , and uploads in postgres (one db for all apps). When running 
locally uses a heroku.test.sqlite database (one for each app). I will post 
instructions so that each app gets its own database. Tickets still go in 
file system and will be accessible via admin interface but every 24hrs the 
file system is wiped out and tickets are lost.

Admin is not in readonly mode but any change you do via admin will be lost 
when the system is reset (every 24 hrs). So you should assume it is 
readonly.

Appadmin works fine.

Is the DAL(…) -> get_db() replacement too much to ask to the users? We 
could do it automatically under the hood once we detect heroku. What do you 
think? Using get_db gives more flexibility for tweaking, specifically when 
multiple databases are present.

There are two files that need to be created (done by 
setup-web2py-heroku.sh): requirements.txt and Procfile. We could ship them 
with web2py but people need to be able to configure them anyway. Should we 
ship them or let users create them?

This should be even easier. People should be able to simply git commit apps 
(with get_db) and pip install web2py. I do not know how to do it because I 
do not understand distutil and git well enough yet. Perhaps people should 
be able to git pull apps directly from the admin running on heroku.


Massimo

-- 



Reply via email to