Upgrading

In the “site” page of the administrative interface there is an “upgrade now” button. In case this is not feasible or does not work (for example because of a file locking issue), upgrading web2py manually is very easy.

Simply unzip the latest version of web2py over the old installation.

This will upgrade all the libraries as well as the applications admin, examples, welcome. It will also create a new empty file “NEWINSTALL”. Upon restarting, web2py will delete the empty file and package the welcome app into “welcome.w2p” that will be used as the new scaffolding app.

web2py does not upgrade any file in your applications. Some important parts of the framework are not part of the libraries, but part of the Welcome app. New apps will inherit these framework changes, but not existing apps. You need to do copy or merge changes manually. Sometimes this is necessary to take advantage of new functionality, and sometimes it is necessary for compatibility with new releases, particularly if you are using experimental features. The web2py group at Google Groups is a good way to keep track of necessary changes. Parts of the welcome app to copy to existing apps are the appadmin controller, the top-level views including appadmin.html and the generic views, and the contents of the static folder which contains the latest version of important javascript files. Obviously you need to merge your changes (if any). Keeping backups or using a version control system is a sound idea.

  1. # When you upgrade web2py your should update app files that are important to web2py for properly functioning
  2. #
  3. # views/
  4. # appadmin.html
  5. # generic.ics
  6. # generic.load
  7. # generic.rss
  8. # layout.html
  9. # generic.json
  10. # generic.map
  11. # generic.xml
  12. # web2py_ajax.html
  13. # generic.html
  14. # generic.jsonp
  15. # generic.pdf
  16. #
  17. # controller/
  18. # appadmin.py
  19. #
  20. # static/
  21. # css/*
  22. # images/*
  23. # js/*
  24. #
  25. # You can do it with the following bash commands :
  26. # NOTE: Please make a backup of your app before to make sure you don't break anything
  27. #
  28. # From web2py/applications/
  29. cp -R welcome/static/* YOURAPP/static/
  30. cp welcome/controllers/appadmin.py YOURAPP/controllers/
  31. cp -R welcome/views/* YOURAPP/views/