File: hellostan.py

package info (click to toggle)
nevow 0.10.0-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 3,264 kB
  • ctags: 5,311
  • sloc: python: 21,511; ansic: 136; sh: 65; xml: 42; makefile: 32; sql: 5
file content (26 lines) | stat: -rw-r--r-- 669 bytes parent folder | download | duplicates (7)
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
from twisted.application import internet, service

from nevow import appserver
from nevow import loaders
from nevow import rend
from nevow import tags as T


class Page(rend.Page):
    """Example of using stan to render a page.
    """
    addSlash = True
    docFactory = loaders.stan(
        T.html[
            T.head[
                T.title['Hello'],
                ],
            T.body[
                T.p(id="body")['Welcome to the wonderful world of Nevow!'],
                ],
            ]
        )

application = service.Application('hellostan')
webServer = internet.TCPServer(8080, appserver.NevowSite(Page()))
webServer.setServiceParent(application)