Changeset 4863
- Timestamp:
- 07/01/08 09:16:41 (5 months ago)
- Files:
-
- trunk/docs/main/BasicMoves.rst (modified) (8 diffs)
- trunk/docs/main/CommandLine.rst (modified) (1 diff)
- trunk/docs/main/Contributing.rst (modified) (1 diff)
- trunk/docs/main/Deployment.rst (modified) (1 diff)
- trunk/docs/main/DevStatus.rst (modified) (1 diff)
- trunk/docs/main/DownloadInstall.rst (modified) (6 diffs)
- trunk/docs/main/LogSetup.rst (modified) (1 diff)
- trunk/docs/main/OfflineInstall.rst (modified) (1 diff)
- trunk/docs/main/Profile.rst (modified) (1 diff)
- trunk/docs/main/QuickStart.rst (modified) (1 diff)
- trunk/docs/main/SimpleWidgetForm.rst (modified) (1 diff)
- trunk/docs/main/TGandPyAMF.rst (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/docs/main/BasicMoves.rst
r4575 r4863 1 TurboGears 2 at a glance 2 ======================== 1 3 2 3 4 5 TurboGears 2 at a glance 6 =========================== 7 8 :Status: Work in progres 4 :Status: Work in progress 9 5 10 6 TurboGears 2, like TurboGears 1 and many other modern web frameworks, uses a pattern called "Model View Controller", or "MVC" pattern. Basically the MVC pattern is an attempt to separate the code which handles what the user sees (the view) from the code that responds to user actions (the controller) and code that changes the state of data (the model). … … 12 8 The goal of the MVC pattern is to help you create more flexible software, and since web-applications tend to have more user-interface changes than anything else, it's particularly designed so that you can change the `view` code without necessarily having to change anything else. 13 9 14 You have to follow the tutorial ` quickstart a project <QuickStart>`_ and serve the project first.10 You have to follow the tutorial `Quickstart a TurboGears 2 Project <QuickStart.html>`_ and serve the project first. 15 11 Then we could exam some basic moves the you could do with TurboGears 2. 16 12 17 13 18 14 Hello World using template 19 -------------------------- -----15 -------------------------- 20 16 21 17 Let's take advantage of that fact and make update our view with a Hello World headline. … … 23 19 To keep the tutorial small and simple, we make a assumption that you already have some knowledge about html tags. 24 20 25 Edit helloworld/templates/index.html, add a <h1> tag like this:: 21 Edit helloworld/templates/index.html, add a <h1> tag like this: 22 23 .. code-block:: html 26 24 27 25 ... … … 39 37 -------------------------------- 40 38 41 Open a new file, edit the content as a simple html file:: 39 Open a new file, edit the content as a simple html file: 40 41 .. code-block:: html 42 42 43 43 <html> … … 61 61 In this case we will add a new method called hello, which just returns a string. TG2 allows us to bypass the template process and return a string directly to the http response, which will be returned to the browser directly. 62 62 63 Edit controller/root.py:: 63 Edit controller/root.py: 64 65 .. code-block:: python 64 66 65 67 from my-project-name.lib.base import BaseController … … 82 84 So far we're getting somewhere, we've been returning plaintext for every incoming request. But you might have noticed how the default welcome page work. 83 85 84 We can edit index template, use controllers to define new url's. But let's take it one step further and create yet another new URL, plug plug real templates into the controllers, and this time rather than returning a string, we'll return a dictionary:: 86 We can edit index template, use controllers to define new url's. But let's take it one step further and create yet another new URL, plug plug real templates into the controllers, and this time rather than returning a string, we'll return a dictionary: 87 88 .. code-block:: python 85 89 86 90 from helloworld.lib.base import BaseController … … 101 105 102 106 That means that we've now got a 'hello' variable in our template which we can use, and we attach the template 'helloworld.templates.index' to 'new_hello' method. So let's edit helloworld/template/index.html to replace the h1 tag we 103 added earlier with:: 107 added earlier with: 108 109 .. code-block:: html 104 110 105 111 <h1 py:replace="hello">hello</h1> … … 113 119 114 120 115 Not every template has dynamic content and therefore may not need arguments. In that case, just return an empty dictionary:: 121 Not every template has dynamic content and therefore may not need arguments. In that case, just return an empty dictionary: 122 123 .. code-block:: python 116 124 117 125 @expose(template="helloworld.templates.index") trunk/docs/main/CommandLine.rst
r4370 r4863 1 2 3 1 4 2 Use TurboGears Command Line Tools trunk/docs/main/Contributing.rst
r4699 r4863 1 ##This is an official page. Only editors and admins can change it.2 3 4 5 1 Contributing to TurboGears 6 2 ========================== trunk/docs/main/Deployment.rst
r4575 r4863 1 2 ## Please see the page "DocHelp" for guidelines on contributing TurboGears documentation!3 4 5 6 1 Deployment options 7 2 ==================== trunk/docs/main/DevStatus.rst
r4370 r4863 1 ## Please see the page "DocHelp" for guidelines on contributing TurboGears documentation!2 3 4 5 1 TurboGears 2 Project Status 6 2 =========================== trunk/docs/main/DownloadInstall.rst
r4854 r4863 1 .. highlight:: bash 2 1 3 How to install TurboGears 2 2 =========================== ==3 4 Installing Turbo gears2 has been made simple with the advent of the package index. We recommend installing Turbogears2 into a virtual environment4 =========================== 5 6 Installing TurboGears 2 has been made simple with the advent of the package index. We recommend installing TurboGears 2 into a virtual environment 5 7 so that any existing packages will not interfere. The basic installation goes as follows: 6 8 7 1. Install setuptools8 9 2. Install virtualenv10 11 3. Create a virtualenvfor your project12 13 4. switch to the virtualenv14 15 5. easy_install turbogears development package16 17 6. profit.9 1. Install ``setuptools`` 10 11 2. Install ``virtualenv`` 12 13 3. Create a ``virtualenv`` for your project 14 15 4. Switch to the ``virtualenv`` 16 17 5. ``easy_install`` TurboGears development package 18 19 6. Profit 18 20 19 21 20 22 Prerequisites: 21 ----------------------- 22 * python 2.4 or 2.5 23 * appropriate python development package (python*-devel python*-dev) 23 -------------- 24 25 * Python 2.4 or 2.5 26 * Appropriate python development package (python*-devel python*-dev) 24 27 25 28 Setting up setuptools: 26 ----------------------- 27 28 $ curl http://peak.telecommunity.com/dist/ez_setup.py | sudo python 29 29 ---------------------- 30 31 .. code-block:: bash 32 33 $ curl http://peak.telecommunity.com/dist/ez_setup.py | sudo python 30 34 31 35 Setting up a Virtual Environment: 32 ----------------------------------- 33 34 $ sudo easy_install virtualenv 35 36 produces: 37 :: 36 --------------------------------- 37 38 First, install ``virtualenv`` using this command: 39 40 .. code-block:: bash 41 42 $ sudo easy_install virtualenv 43 44 will output something like: 45 46 .. code-block:: text 38 47 39 48 Searching for virtualenv … … 42 51 Downloading http://pypi.python.org/packages/2.5/v/virtualenv/virtualenv-1.1-py2.5.egg#md5=1db8cdd823739c79330a138327239551 43 52 Processing virtualenv-1.1-py2.5.egg 44 creating /Users/percious/oss/tgdev/lib/python2.5/site-packages/virtualenv-1.1-py2.5.egg 45 Extracting virtualenv-1.1-py2.5.egg to /Users/percious/oss/tgdev/lib/python2.5/site-packages 46 Adding virtualenv 1.1 to easy-install.pth file 47 Installing virtualenv script to /Users/percious/oss/tgdev/bin 48 49 Installed /Users/percious/oss/tgdev/lib/python2.5/site-packages/virtualenv-1.1-py2.5.egg 53 ..... 50 54 Processing dependencies for virtualenv 51 55 Finished processing dependencies for virtualenv 52 56 53 $ virtualenv tg2env --no-site-packages 54 produces: 55 :: 57 Create a virtual environment: 58 59 .. code-block:: bash 60 61 $ virtualenv --no-site-packages tg2env 62 63 that produces:: 56 64 57 65 Using real prefix '/usr/local' 58 New python executable in tg dev/bin/python66 New python executable in tg2env/bin/python 59 67 Installing setuptools............done. 60 68 61 $ cd tg2env 62 63 $ source bin/activate 64 and now your prompt should look something like: 65 :: 66 67 (tg2dev)usrname@host:tgdev $ 68 69 Install Turbogears2: 69 .. code-block:: bash 70 71 $ cd tg2env 72 73 .. code-block:: bash 74 75 $ source bin/activate 76 77 and now your prompt should look something like:: 78 79 (tg2env)usrname@host:tgenv$ 80 81 Install Turbogears 2 70 82 --------------------- 71 $ easy_install -i http://www.turbogears.org/2.0/downloads/1.9.7a1/index tg.devtools 72 73 a whole bunch of packages should download. (this will take a little while) 83 84 .. code-block:: bash 85 86 $ easy_install -i http://www.turbogears.org/2.0/downloads/1.9.7a1/index tg.devtools 87 88 A whole bunch of packages should download. (this will take a little while) 74 89 75 90 Validate the installation: 76 -------------------------- --91 -------------------------- 77 92 78 93 To check if you installed TurboGears 2 correctly, type 79 94 80 $ paster --help 81 82 should look something like: 83 :: 95 .. code-block:: bash 96 97 $ paster --help 98 99 should look something like:: 84 100 85 101 Usage: paster [paster_options] COMMAND [command_options] … … 118 134 119 135 120 Installing the development version of Turbogears 2 (from source)136 Installing the development version of Turbogears 2 (from source) 121 137 ================================================================ 122 123 138 124 139 Installing Pylons from Source: … … 146 161 147 162 Installing TurboGears 2 from Source: 148 ------------------------------------ ------------163 ------------------------------------ 149 164 150 165 TurboGears 2 are constructed by a bunch of packages. … … 199 214 When installing on Mac OSX, if you get an error mentioning "No local packages or download links found for RuleDispatch", you can try the solution posted to the `ToscaWidgets discussion list <http://groups.google.com/group/toscawidgets-discuss/browse_thread/thread/cb6778810e96585d>`_, which advises downloading it directly:: 200 215 201 .$ sudo easy_install -U -f http://toscawidgets.org/download/wo_speedups/ RuleDispatch216 $ sudo easy_install -U -f http://toscawidgets.org/download/wo_speedups/ RuleDispatch 202 217 203 218 If you get the following error when starting a project with ``paster serve``:: 204 219 205 .AttributeError: 'WSGIRequest' object has no attribute 'accept_language'220 AttributeError: 'WSGIRequest' object has no attribute 'accept_language' 206 221 207 222 update your Pylons checkout with ``hg update`` and try again. … … 209 224 If ``python setup.py develop`` gives you:: 210 225 211 .Traceback (most recent call last):212 .File "setup.py", line 3, in <module>213 .from ez_setup import use_setuptools226 Traceback (most recent call last): 227 File "setup.py", line 3, in <module> 228 from ez_setup import use_setuptools 214 229 215 230 trunk/docs/main/LogSetup.rst
r4370 r4863 1 2 3 1 Configuring and using the Logging System 4 2 ========================================= trunk/docs/main/OfflineInstall.rst
r4370 r4863 1 ## Please see the page "DocHelp" for guidelines on contributing TurboGears documentation!2 3 4 1 :status: Unofficial 5 2 trunk/docs/main/Profile.rst
r4575 r4863 1 ## Please see the page "DocHelp" for guidelines on contributing TurboGears documentation!2 3 4 1 5 2 Profiling your app trunk/docs/main/QuickStart.rst
r4626 r4863 1 2 1 .. highlight:: bash 3 2 4 3 Quickstarting a TurboGears 2 project 5 4 ==================================== 6 5 7 :Status: Work in progres 6 :Status: Work in progress 8 7 9 8 .. contents:: Table of Contents 10 9 :depth: 2 11 12 10 13 11 Now that you've got TurboGears installed. TurboGears 2 extends the 'paster' command line tool to provide a suite of tools for working with TurboGears 2 projects. A few will be touched upon in this tutorial, check the 'paster --help' command for a full listing. trunk/docs/main/SimpleWidgetForm.rst
r4633 r4863 1 ## This is a contributed page. You must be logged in to change it.2 #acl EditorGroup:read,write Known:read,write All:read3 4 5 6 1 Simple Widget Form Tutorial 7 2 =========================== trunk/docs/main/TGandPyAMF.rst
r4370 r4863 4 4 ============================== 5 5 6 :Status: Work in progres 6 :Status: Work in progress 7 7 8 8 .. contents:: Table of Contents