Finally, as described in Chapter 4, we need to run the mail_queue.py script
as if it were inside a controller in our app:

1

python web2py.py -S app -M -N -R applications/app/private/mail_queue.py

where -S app tells web2py to run "mail_queue.py" as "app", -M tells web2py
to execute models, and -N tells web2py not to run cron.

For background task :
http://web2py.com/books/default/chapter/34/08/email-and-sms#Sending-messages-using-a-background-task
.

I was simply following the command given in this document.



Best,
Chetan Jain

On Thu, Jul 14, 2016 at 12:29 AM, Dave S <[email protected]> wrote:

>
>
> On Wednesday, July 13, 2016 at 11:52:51 AM UTC-7, Chetan Jain wrote:
>>
>> python web2py.py -S social -M -N -R
>> applications/social/private/sms_queue.py
>> Usage: python web2py.py
>>
>> web2py.py: error: no such option: -N
>>
>>
> What are you expecting -N to do?
>
> The actual command line options are listed at
> <URL:
> http://web2py.com/books/default/chapter/29/04/the-core#Command-line-options
> >
>
>
>> Best,
>> Chetan Jain
>>
>>
>
> /dps
>
>
>> On Wed, Jul 13, 2016 at 11:39 PM, Dave S <[email protected]> wrote:
>>
>>>
>>>
>>> On Wednesday, July 13, 2016 at 9:31:13 AM UTC-7, Chetan Jain wrote:
>>>>
>>>> Hi Anthony,
>>>>
>>>>
>>>>    Scenario is : I've to send a 'status' SMS to a phone_number after
>>>> every 30 minutes and Append its Status statement on a webpage, Since I have
>>>> to send SMS after every 30 minutes, I have to call function after 30
>>>> minutes each.
>>>>
>>>> This is what i'm trying to implement,
>>>> I've already coded all function in python, i'm getting difficulties in
>>>> web part only.
>>>>
>>>>
>>>>
>>> use scheduler to launch long process, record PID of same.
>>> user scheduler to launch periodic checker, look for PID of long
>>> process.  Unqueue periodic checker when PID removed.
>>>
>>>
>>>
>>>>
>>>> Plus one more problem,
>>>>
>>>> i'm using request.now for getting date and time, however i'm getting
>>>> same value.
>>>>
>>>>
>>>> for i in range(5):
>>>>         print request.now
>>>>         time.sleep(5)
>>>>         pass
>>>>
>>>>
>>>> output i'm getting is :
>>>>
>>>> 2016-07-13 21:27:50.658693
>>>> 2016-07-13 21:27:50.658693
>>>> 2016-07-13 21:27:50.658693
>>>> 2016-07-13 21:27:50.658693
>>>> 2016-07-13 21:27:50.658693
>>>>
>>>>
>>>> expected output is delay of 5 seconds each time.
>>>>
>>>>
>>> request.now is set at the time web2py begins processing the request.  It
>>> remains constant for the duration of the request.  If you need to find out
>>> the time after you've done some processing, use datetime.datetime.now.
>>>
>>> But do not sleep more than a little bit in a request ... the front end
>>> will timeout the thread you're in.
>>>
>>>
>>>
>>>
>>>> Best,
>>>> Chetan Jain
>>>>
>>>>
>>> /dps
>>>
>>>
>>>
>>>> On Wed, Jul 13, 2016 at 12:04 AM, Anthony <[email protected]> wrote:
>>>>
>>>>> On Tuesday, July 12, 2016 at 11:41:20 AM UTC-4, Massimo Di Pierro
>>>>> wrote:
>>>>>>
>>>>>> forget load in this case.
>>>>>>
>>>>>> <div id="target">
>>>>>> </div>
>>>>>>
>>>>>> <script>
>>>>>> var counter = 0;
>>>>>> var minutes = 2;
>>>>>> var max_calls = 10;
>>>>>> var url = "{{=URL('call')}}";
>>>>>> var f = function() {
>>>>>>     counter = counter + 1;
>>>>>>     jQuery.get(url).done(function(data) {
>>>>>>        jQuery('#target').html(data);
>>>>>>        if(counter<max_calls)
>>>>>>           setTimeout(f, minutes*60*1000);
>>>>>>     });
>>>>>> }
>>>>>> f();
>>>>>> </script>
>>>>>>
>>>>>
>>>>> How is the above different from:
>>>>>
>>>>> {{=LOAD('call', ajax=True, timeout=2*60, times=10)}}
>>>>>
>>>>> Anthony
>>>>>
>>>>>
>>>>>>
>>>>>> On Tuesday, 12 July 2016 08:47:44 UTC-5, Chetan Jain wrote:
>>>>>>
>>>>>>> URL : https://pqr.pythonanywhere.com/ajax/default/index
>>>>>>>
>>>>>>> Best,
>>>>>>> Chetan Jain
>>>>>>>
>>>>>>> On Tue, Jul 12, 2016 at 6:07 PM, Massimo Di Pierro <
>>>>>>> [email protected]> wrote:
>>>>>>>
>>>>>>>> It is not clear. Where is your app?
>>>>>>>>
>>>>>>>>
>>>>>>>> On Tuesday, 12 July 2016 06:32:29 UTC-5, Chetan Jain wrote:
>>>>>>>>>
>>>>>>>>> Hi Anthony,
>>>>>>>>>
>>>>>>>>>   i've created one 24 hours web2py application at
>>>>>>>>> pythonanywhere.com, please let me know when you have 10-15
>>>>>>>>> minutes of time, so that i can rectify my problem.
>>>>>>>>>   Thanks in advance.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Tue, Jul 12, 2016 at 7:43 AM, Anthony <[email protected]>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>> If your view includes an {{=i}} variable, then your function must
>>>>>>>>>> return a dictionary with "i" as one of its keys. Hard to say what's 
>>>>>>>>>> wrong
>>>>>>>>>> without seeing the current version of this function.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Best,
>>>>>>>>> Chetan Jain
>>>>>>>>>
>>>>>>>> --
>>>>>>>> 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.
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>> 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.
>>>>>
>>>>
>>>> --
>>> 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.
>>>
>>
>> --
> 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.
>

-- 
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