| | 1 | |
| | 2 | Using FirePython with TurboGears2 |
| | 3 | ============================== |
| | 4 | |
| | 5 | :Status: Work in progress |
| | 6 | |
| | 7 | .. contents:: Table of Contents |
| | 8 | :depth: 2 |
| | 9 | |
| | 10 | FirePython is a sexy Python logger console integrated into Firebug. |
| | 11 | |
| | 12 | Requires |
| | 13 | ---------------- |
| | 14 | |
| | 15 | - Firefox - http://www.mozilla.com/en-US/firefox/ |
| | 16 | - Firebug - https://addons.mozilla.org/en-US/firefox/addon/1843 |
| | 17 | - FireLogger - https://addons.mozilla.org/en-US/firefox/addon/11090 |
| | 18 | |
| | 19 | |
| | 20 | Installing Stuff |
| | 21 | ---------------------- |
| | 22 | |
| | 23 | If you haven't installed TG2, you'll need to do that first (http:docs.turbogears.org/2.0/RoughDocs/DownloadInstall). Once you've got an up-to-date version of TG2, you'll need to install FirePython and some dependancies, which you can do by:: |
| | 24 | |
| | 25 | easy_install firepython |
| | 26 | easy_install python-cjson |
| | 27 | easy_install jsonpickle |
| | 28 | |
| | 29 | After that's done, you can create a new TG2 project in the normal way :: |
| | 30 | |
| | 31 | paster quickstart firepythontest |
| | 32 | ... |
| | 33 | cd firepythontest |
| | 34 | paster serve development.ini --reload |
| | 35 | |
| | 36 | Your project should now be started, and you should be able to browse to it at http://127.0.0.1:8080 |
| | 37 | |
| | 38 | Adding FirePython Support |
| | 39 | ---------------------------- |
| | 40 | |
| | 41 | Now, you're ready to add FirePython Middleware to your app:: |
| | 42 | |
| | 43 | Edit firepythontest/config/middleware.py |
| | 44 | |
| | 45 | Add: |
| | 46 | from firepython.middleware import FirePythonWSGI |
| | 47 | |
| | 48 | Insert After line "app = make_base_app(global_conf, full_stack=True, **app_conf)" |
| | 49 | app = FirePythonWSGI(app) |
| | 50 | |
| | 51 | This will wrap your Turbogears App with FirePython, and any/all Log messages will become available in Firebug. |
| | 52 | |
| | 53 | |
| | 54 | |
| | 55 | |