Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-release > by-pkgid > da3f2a4ce20b26cb5976aa965c74e071 > files > 3214

python2-twisted-19.2.0-1.mga7.armv7hl.rpm

# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.

"""
This is a resource file that renders a static web page.

To test the script, rename the file to hello.rpy, and move it to any directory,
let's say /var/www/html/.

Now, start your Twisted web server:
    $ twistd -n web --path /var/www/html/

And visit http://127.0.0.1:8080/hello.rpy with a web browser.
"""

from twisted.web import static
import time

now = time.ctime()

d = '''\
<HTML><HEAD><TITLE>Hello Rpy</TITLE>

<H1>Hello World, It is Now %(now)s</H1>

<UL>
''' % vars()

for i in range(10):
    d += "<LI>%(i)s" % vars()

d += '''\
</UL>

</BODY></HTML>
'''

resource = static.Data(d, 'text/html')