The first thing is identifying the reason of the slow load. Is the render of the view, the controller, or the data access? you can debug or strip parts of your code to find that.

By example, if your code loads too many questions and/or answers it will be really slow because there will be too many objects in memory.

Greetings.


El 11/06/18 a las 08:22, Maurice Waka escribió:
I have an HTML page that take long to load,about 60 to 60 seconds sometimes. This is the code.
|
{{extend "layout.html"}}
<html lang="en">
<head>
<link rel="shortcut icon"href="favicon.ico"/>
<link href="{{=URL('static', 'css/view_searches.css')}}"rel="stylesheet"type="text/css"/>
</head>
    <body>
        <div class="chat_window">
        <ul class="messages">
        {{for reply in replies:}}
        <li class="message left appeared">
        <div>
        {{=prettydate(reply.modified_on)}}
        </div>
<div class="text_wrapper">
<div class="text">{{=XML(reply.quest,sanitize=True)}}</div>
</div>
        </li>
<li class="message right appeared">
<div>
{{=prettydate(reply.modified_on)}}
</div>
        <div class="text_wrapper">
        <div class="text">{{=XML(reply.message, sanitize=True)}}</div>
</div>
        </li>
{{pass}}
</ul>
        <div class="bottom_wrapper clearfix">
        <div class="message_input_wrapper">
        <div class="message_input_wrapper">
        {{=form.custom.begin}}
        <textarea name="message" id="message_input" placeholder="Type your message here..."></textarea>
<button>send</button>
        {{=form.custom.end}}
        </div>
</div>
        </div>
</div>
        <div class="message_template">
        <li class="message">
        <div class="message-data-time" ></div>
<div class="text_wrapper">
<div class="text"></div>
</div>
        </li>
</div>
    </body>
|

the controller code is as follows:
|
replies =db(db.answers.author ==auth.user.id).select(db.answers.ALL)[-7:-1]#:-1]##if getting upto the last record, it appears twice when posting on view     question =db(db.answers.author ==auth.user.id).select(orderby=~db.answers.created_on,limitby=(2,0))     answer =db(db.answers.author ==auth.user.id).select(orderby=~db.answers.created_on,limitby=(2,0))
    q =''
    a =''
forq inquestion:
        q =XML(q.quest,sanitize=True)
fora inanswer:
        a =XML(a.message,sanitize=True)
returndict(form=form,q=q,a=a,replies=replies)


|
How can I make it load faster?
KInd regards
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>.
For more options, visit https://groups.google.com/d/optout.

--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- You received this message because you are subscribed to the Google Groups "web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to