<html>
2 <head></head>
3 <body>
4 <h1>{{=message}}</h1>
5 </body>
6 </html>


This says all, I guess you have copied the whole text even the row numbers.

You don´t need a HTML or BODY tag, the /views/default/index.html should only contain

{{=message}}


Row number is shown in the manual only so that it is easier in the text to explain things. Row number are not used in python.


Kenneth



Attached.

------------------------------------------------------------------------
*From:* Anthony <[email protected]>
*To:* [email protected]
*Cc:* Hal Smith <[email protected]>
*Sent:* Wed, March 23, 2011 6:29:21 PM
*Subject:* Re: Runnning my new app

Hmm, that is odd. Can you send the whole app? On the admin Site page, just click the "pack all" button for the app, and it will pack everything into a .w2p file.

On Wednesday, March 23, 2011 6:15:18 PM UTC-4, Hal Smith wrote:

    My controllers/default.py define index() has the return dic code.

    My views/default/index.html contains only the code in the manual
    (I deleted everything else).

    Attached is a screen dump of the output.

    ------------------------------------------------------------------------
    *From:* Anthony <[email protected]>
    *To:* [email protected]
    *Cc:* Hal Smith <[email protected]>
    *Sent:* Wed, March 23, 2011 3:36:05 PM
    *Subject:* Re: Runnning my new app

    On Wednesday, March 23, 2011 4:58:45 PM UTC-4, Hal Smith wrote:

        This is the kind of thing I have been wondering about: what is
        going on under the hood?

        I was simply doing what the manual told me to do - even if I
        wasn't sure what it wanted. The manual needs to be updated.

    Note, if you're on p. 88 doing the "Say Hello" example, you have
    not yet gotten to the stuff about using layouts and {{include}} --
    that stuff starts in p. 92 in the "Let's Count" section. Because
    ch. 3 is tutorial style, explanations tend to be limited to what's
    going on with the immediate example, so you learn the details
    progressively. On p. 87, you learn that returning a string from
    your controller function simply sends the string as is to the
    browser (it's not inserted into any view/template). On p. 88, you
    learn that if you return a dictionary (instead of a string),
    web2py looks for the associated view file (and uses the generic
    view if it can't be found). And then on p. 92, you learn about
    extending a layout template.
    I think the instruction about editing index.html on p. 88 could
    probably be improved. First, where it says "the new file
    associated with the action", it should probably say "the view file
    associated with the action". Second, it should probably explicitly
    say to completely replace the existing index.html content with the
    example code to avoid confusion. I'll make some edits to help clarify.
    As for the numbers above and below your message, I can't explain
    that. Are you sure your index.html includes only the text from p.
    88 and your controller is just:
    def index():
        return dict(message="Hello from MyApp")
    Anthony


Reply via email to