Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

root/branches/cherrypy-2.x/docs/book/xml/byexample.xml

Revision 721 (checked in by speno, 3 years ago)

doc syntax and typo fix.

  • Property svn:executable set to *
Line 
1 <?xml version="1.0" encoding="utf-8"?>
2 <chapter xmlns:db="http://docbook.org/docbook-ng"
3          xmlns:xi="http://www.w3.org/2001/XInclude"
4          xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5          xml:id="byexample">
6   <title>CherryPy By Example</title>
7   <para>
8     The best way to learn CherryPy is to look at example programs.
9   </para>
10   <section>
11     <title>Hello World</title>
12     <para>Save the code under a file named helloworld.py.
13     Then to start up the application, type the following command:</para>
14     <cmdsynopsis>
15       <command>python</command>
16       <arg choice="req">helloworld.py</arg>
17     </cmdsynopsis>
18     <para>You will see some information on your terminal window which
19     are the log of the web server.</para>
20     <para>Then simply point your browser to http://localhost:8080 and
21     say Bravo!</para>
22     <example>
23       <title>Hello World</title>
24       <programlisting>
25         <code language="python">
26           <xi:include parse="text" href="../../../cherrypy/tutorial/tut01_helloworld.py" />
27         </code>
28       </programlisting>
29     </example>
30   </section>
31
32   <section>
33     <title>Exposed Methods</title>
34     <para>
35     For security reasons, CherryPy requires developers to explicitly specify which methods may
36     be accessed via the web. The method's 'exposed' attribute, when True, indicates that a given
37     method is published to the web.
38     </para>
39     <example>
40       <title>Exposed Methods</title>
41       <programlisting>
42         <code language="python">
43           <xi:include parse="text" href="../../../cherrypy/tutorial/tut02_expose_methods.py" />
44         </code>
45       </programlisting>
46     </example>
47   </section>
48
49   <!-- lets save this for later
50  
51   <section>
52     <title>Get and Post</title>
53     <para>
54     The majority of web applications need to deal with HTML forms and consequently HTTP GET and POST.
55     GET and POST variables are automatically decoded and passed to exposed methods as named arguments.
56     </para>
57     <example>
58       <title>Get and Post</title>
59       <programlisting>
60         <code language="python">
61           <xi:include parse="text" href="../../../cherrypy/tutorial/tut03_get_and_post.py" />
62         </code>
63       </programlisting>
64     </example>
65   </section>
66
67   <section>
68     <title>Complex Site</title>
69     <example>
70       <title>Complex Site</title>
71       <programlisting>
72         <code language="python">
73           <xi:include parse="text" href="../../../cherrypy/tutorial/tut04_complex_site.py" />
74         </code>
75       </programlisting>
76     </example>
77   </section>
78
79   <section>
80     <title>Derived Objects</title>
81     <example>
82       <title>Derived Objects</title>
83       <programlisting>
84         <code language="python">
85           <xi:include parse="text" href="../../../cherrypy/tutorial/tut05_derived_objects.py" />
86         </code>
87       </programlisting>
88     </example>
89   </section>
90
91   <section>
92     <title>Default Method</title>
93     <example>
94       <title>Default Method</title>
95       <programlisting>
96         <code language="python">
97           <xi:include parse="text" href="../../../cherrypy/tutorial/tut06_default_method.py" />
98         </code>
99       </programlisting>
100     </example>
101   </section>
102
103   <section>
104     <title>Sessions</title>
105     <example>
106       <title>Sessions</title>
107       <programlisting>
108         <code language="python">
109           <xi:include parse="text" href="../../../cherrypy/tutorial/tut07_sessions.py" />
110         </code>
111       </programlisting>
112     </example>
113   </section>
114
115   <section>
116     <title>Generator</title>
117     <example>
118       <title>Generator</title>
119       <programlisting>
120         <code language="python">
121           <xi:include parse="text" href="../../../cherrypy/tutorial/tut08_generators_and_yield.py" />
122         </code>
123       </programlisting>
124     </example>
125   </section>
126
127   <section>
128     <title>Session Filter</title>
129     <example>
130       <title>Session Filter</title>
131       <programlisting>
132         <code language="python">
133           <xi:include parse="text" href="../../../cherrypy/tutorial/tut09_sessionfilter.py" />
134         </code>
135       </programlisting>
136     </example>
137   </section>
138
139   <section>
140     <title>File Upload</title>
141     <example>
142       <title>File Upload</title>
143       <programlisting>
144         <code language="python">
145           <xi:include parse="text" href="../../../cherrypy/tutorial/tut10_file_upload.py" />
146         </code>
147       </programlisting>
148     </example>
149   </section>
150
151   -->
152   <xi:include href="buildingblog.xml" />
153 </chapter>
Note: See TracBrowser for help on using the browser.

Hosted by WebFaction

Log in as guest/cpguest to create tickets