File: inst-testing.html

package info (click to toggle)
libapache-mod-python 2%3A2.7.8-0.0woody5
  • links: PTS
  • area: main
  • in suites: woody
  • size: 1,312 kB
  • ctags: 850
  • sloc: ansic: 2,782; python: 1,115; makefile: 260; sh: 246
file content (155 lines) | stat: -rw-r--r-- 5,152 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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>2.4 Testing</title>
<META NAME="description" CONTENT="2.4 Testing">
<META NAME="keywords" CONTENT="modpython">
<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="modpython.css">
<LINK REL="next" href="inst-trouble.html">
<LINK REL="previous" href="inst-installing.html">
<LINK REL="up" href="installation.html">
<LINK REL="next" href="inst-trouble.html">
</head>
<body>
<DIV CLASS="navigation">
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="inst-apacheconfig.html"><img src="icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="installation.html"><img src="icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="inst-trouble.html"><img src="icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Mod_python Manual</td>
<td><A href="contents.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><A href="genindex.html"><img src="icons/index.gif"
  border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="inst-apacheconfig.html">2.3.2 Configuring Apache</A>
<b class="navlabel">Up:</b> <a class="sectref" href="installation.html">2. Installation</A>
<b class="navlabel">Next:</b> <a class="sectref" href="inst-trouble.html">2.5 Troubleshooting</A>
<br><hr>
</DIV>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION004400000000000000000">&nbsp;</A>
<BR>
2.4 Testing
</H1>

<P>

<OL>
<LI>Make some directory that would be visible on your web site, for
example, htdocs/test.

<P>
</LI>
<LI>Add the following Apache directives, which can appear in either the
main server configuration file, or <span class="file">.htaccess</span>.  If you are going
to be using the <span class="file">.htaccess</span> file, you will not need the
<code>&lt;Directory&gt;</code> tag below, and you will need to make sure the
<code>AllowOverride</code> directive applicable to this directory has at least
<code>FileInfo</code> specified. (The default is <code>None</code>, which will not work.)

<P>
<dl><dd><pre class="verbatim">
&lt;Directory /some/directory/htdocs/test&gt; 
  AddHandler python-program .py
  PythonHandler mptest 
  PythonDebug On 
&lt;/Directory&gt;
</pre></dl>

<P>
(Substitute <span class="file">/some/directory</span> above for something applicable to
your system, usually your Apache ServerRoot)

<P>
</LI>
<LI>At this time, if you made changes to the main configuration file, you
will need to restart Apache in order for the changes to take effect.

<P>
</LI>
<LI>Edit <span class="file">mptest.py</span> file in the <span class="file">htdocs/test</span> directory so
that is has the following lines (be careful when cutting and pasting
from your browser, you may end up with incorrect indentation and a
syntax error):

<P>
<dl><dd><pre class="verbatim">
from mod_python import apache

def handler(req):
    req.send_http_header()
    req.write("Hello World!")
    return apache.OK
</pre></dl>

<P>
</LI>
<LI>Point your browser to the URL referring to the <span class="file">mptest.py</span>; you
should see <code>"Hello World!"</code>. If you didn't - refer to the
troubleshooting section next.

<P>
</LI>
<LI>If everything worked well, move on to Chapter <A href="tutorial.html#tutorial">3</A>, 
<em class='citetitle'><a
 href='tutorial.html'
 title='Tutorial'
 >Tutorial</a></em>. 

<P>
</LI>
</OL>

<P>

<DIV CLASS="navigation">
<p><hr>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td><A href="inst-apacheconfig.html"><img src="icons/previous.gif"
  border="0" height="32"
  alt="Previous Page" width="32"></A></td>
<td><A href="installation.html"><img src="icons/up.gif"
  border="0" height="32"
  alt="Up One Level" width="32"></A></td>
<td><A href="inst-trouble.html"><img src="icons/next.gif"
  border="0" height="32"
  alt="Next Page" width="32"></A></td>
<td align="center" width="100%">Mod_python Manual</td>
<td><A href="contents.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><A href="genindex.html"><img src="icons/index.gif"
  border="0" height="32"
  alt="Index" width="32"></A></td>
</tr></table>
<b class="navlabel">Previous:</b> <a class="sectref" href="inst-apacheconfig.html">2.3.2 Configuring Apache</A>
<b class="navlabel">Up:</b> <a class="sectref" href="installation.html">2. Installation</A>
<b class="navlabel">Next:</b> <a class="sectref" href="inst-trouble.html">2.5 Troubleshooting</A>
<hr>
<span class="release-info">Release 2.7.8, documentation updated on April 19, 2002.</span>
</DIV>
<!--End of Navigation Panel-->

</BODY>
</HTML>