File: node3.html

package info (click to toggle)
cherrypy 0.10-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 10,324 kB
  • ctags: 1,759
  • sloc: python: 14,411; sh: 6,915; perl: 2,472; makefile: 76
file content (200 lines) | stat: -rw-r--r-- 6,626 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>1. Downloading, installing and running the demo</title>
<META NAME="description" CONTENT="1. Downloading, installing and running the demo">
<META NAME="keywords" CONTENT="tut">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="STYLESHEET" href="tut.css" type='text/css'>
<link rel="first" href="tut.html">
<link rel="contents" href="contents.html" title="Contents">

<LINK REL="next" HREF="node4.html">
<LINK REL="previous" HREF="node2.html">
<LINK REL="up" HREF="tut.html">
<LINK REL="next" HREF="node4.html">
<meta name='aesop' content='information'>
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A HREF="node2.html"><img src="../icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A HREF="tut.html"><img src="../icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A HREF="node4.html"><img src="../icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">CherryPy Tutorial</td>
<td><A HREF="node2.html"><img src="../icons/contents.gif"
  border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><img src="../icons/blank.gif"
  border="0" height="32"
  alt="" width="32"></td>
<td><img src="../icons/blank.gif"
  border="0" height="32"
  alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" HREF="node2.html">Contents</A>
<b class="navlabel">Up:</b> <a class="sectref" HREF="tut.html">CherryPy Tutorial</A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node4.html">2. Concepts used in</A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></a>

<UL CLASS="ChildLinks">
<LI><A href="node3.html#SECTION003100000000000000000">1.1 Prerequisite</a>
<LI><A href="node3.html#SECTION003200000000000000000">1.2 Downloading and installing</a>
<LI><A href="node3.html#SECTION003300000000000000000">1.3 Running the demo</a>
<LI><A href="node3.html#SECTION003400000000000000000">1.4 Stopping the server</a>
</ul>
<!--End of Table of Child-Links-->
<HR>

<H1><A NAME="SECTION003000000000000000000">
1. Downloading, installing and running the demo</A>
</H1>

<P>

<H1><A NAME="SECTION003100000000000000000">
1.1 Prerequisite</A>
</H1>

<P>
CherryPy uses 100% pure Python, so it runs everywhere Python runs (Windows, Unix, Mac, ...).
All you need is a working distribution of Python 2.1 or higher on your machine.

<P>

<H1><A NAME="SECTION003200000000000000000">
1.2 Downloading and installing</A>
</H1>

<P>
Download the latest version of CherryPy from this page <a class="url" href="http://www.cherrypy.org/download">http://www.cherrypy.org/download</a> and
unzip/untar the file

<P>
This will create a <b>CherryPy-version/</b> directory with a few files and sub-directories

<P>

<H1><A NAME="SECTION003300000000000000000">
1.3 Running the demo</A>
</H1>

<P>
Go to the <span class="file">demo/</span> directory and type the following command:

<P>
<div class="verbatim"><pre>
python ../cherrypy.py Root.cpy
</pre></div> <A NAME="tex2html1"
  HREF="#foot657"><SUP>1.1</SUP></A> <A NAME="tex2html2"
  HREF="#foot658"><SUP>1.2</SUP></A>
<P>
This will create a file called <span class="file">RootServer.py</span>

<P>
To run it, just enter:

<P>
<div class="verbatim"><pre>
[remi@serveur demo]$ python RootServer.py
Reading parameters from RootServer.cfg ...
Calling initServer() ...
Reading gaz station database for the Prestation demo ...
Done reading database
Starting Httpd service ...
Server parameters:
portOrUnixFile: 8000
numberOfProcs: 1
staticContentList: [('images', 'images')]
Serving on 8000
</pre></div>

<P>
Then open a web browser an type in the URL: <a class="url" href="http://localhost:8000/">http://localhost:8000/</a>, and voila

<P>
You can play around with the demo website called <b>Prestation</b> or with the
little tests that demonstrate a few of CherryPy's capabilities.

<P>

<H1><A NAME="SECTION003400000000000000000">
1.4 Stopping the server</A>
</H1>

<P>
In most cases, you can just stop the server by hitting "Ctrl-C".

<P>
This will not work if you're using Python-2.1 or Python-2.2 on Windows and the <var>timeoutsocket.py</var> module is not installed. In that case, you can stop the server by hitting "Ctrl-Break".

<P>
If you're on a unix-based system and the server is running in the background, then you can stop it by typing "kill &lt;PID&gt;".

<P>
Now that we've downloaded CherryPy and run the demo, it's time to understand how a
developer can develop a website using CherryPy...

<P>
<BR><HR><H4>Footnotes</H4>
<DL>
<DT><A NAME="foot657">... </A><A
 HREF="node3.html#tex2html1"><SUP>1.1</SUP></A></DT>
<DD>"<tt class="samp">python</tt>" must be in your PATH and it must be version 2.1 or higher

</DD>
<DT><A NAME="foot658">... </A><A
 HREF="node3.html#tex2html2"><SUP>1.2</SUP></A></DT>
<DD>If <var>make</var> is installed on your machine, you can just type "<tt class="samp">make</tt>"

</DD>
</DL>
<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A HREF="node2.html"><img src="../icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A HREF="tut.html"><img src="../icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A HREF="node4.html"><img src="../icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">CherryPy Tutorial</td>
<td><A HREF="node2.html"><img src="../icons/contents.gif"
  border="0" height="32"
  alt="Contents" width="32"></A></td>
<td><img src="../icons/blank.gif"
  border="0" height="32"
  alt="" width="32"></td>
<td><img src="../icons/blank.gif"
  border="0" height="32"
  alt="" width="32"></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" HREF="node2.html">Contents</A>
<b class="navlabel">Up:</b> <a class="sectref" HREF="tut.html">CherryPy Tutorial</A>
<b class="navlabel">Next:</b> <a class="sectref" HREF="node4.html">2. Concepts used in</A>
<hr>
<span class="release-info">Release 0.10, documentation updated on 19 March 2004.</span>
</DIV>
<!--End of Navigation Panel-->
<ADDRESS>
See <i><a href="about.html">About this document...</a></i> for information on suggesting changes.
</ADDRESS>
</BODY>
</HTML>