Hey Jim, I'm failing to understand the scheduler, please if its not a 
bother simplify it for me. In my script below I wanna send users who host 
stuff on my site emails when their subscription is left with 7 days to 
expire. Ideally twice a week for these 7 days. I'm hosting my app with 
pythonanywhere. How do i put it together?

*CODE*:









*import datetimedef email_reminder():    dt=db(db.house_owner).select()    
for dt in dt:            
now_dt=dt.expiry_date-request.now.date()            
now_dt2=now_dt.days            new_con=dt.controller+1            if 
now_dt2 <= 7:                mail.send(to=dt.email_address,subject="House 
Hosting Reminder",message ='Hello %s %s, \nThis is a reminder that your 
house listing with our service will expire in %d days. \nTo increase your 
suscription time or for further details please contact us at the given 
details.\n\nBest regards;' % (dt.Name, dt.Surname, now_dt2))                
db(db.house_owner.controller).update(controller=new_con)*

*Regards;              *

On Tuesday, September 1, 2020 at 4:02:42 PM UTC+2 Jim S wrote:

> The web2py scheduler pretty much is a background task that runs 
> unnoticed.  
>
> I use it in a number of places to queue hundreds or thousands of outbound 
> emails.  I like the scheduler because it then also servers as a log of the 
> emails that were sent.
>
> If that isn't what you're looking for then how about celery or 
> redis-queue?  But, they are a bother because then you have more services 
> you need to grok, start up and manage.  The web2py scheduler takes care of 
> all of that for you.  Let me know if you want to see a sample of how we 
> handle it.
>
> -Jim
>
>
> On Tuesday, September 1, 2020 at 8:41:27 AM UTC-5, mostwanted wrote:
>>
>>
>> Is there a way to have a function always running without having to use a 
>> scheduler?
>> I have a function that i want to always send emails based on its 
>> arguments & conditions but i want it to run in the background unnoticed 
>> like a worker but not run by a scheduler, is this possible? I hope my 
>> question is clear.
>>
>> Regards;
>>
>> Mostwanted 
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/7830407c-0f70-4196-9c64-e66eeb76c3f7n%40googlegroups.com.

Reply via email to