Re: how to get called function automatically inside views.py?

2013-05-03 Thread Timothy Makobu
I would do this by having the view exposed on a url like 127.0.0.1:8000/myview
and having that called from cron via curl, a python script utilizing urllib.


On Fri, May 3, 2013 at 1:37 PM, Avnesh Shakya  wrote:

> thanks but if i want to get a function called autometically, when i run
> 127.0.0.1:8000/  which defined inside views.py. how is it possible.
>
>
> On Fri, May 3, 2013 at 4:00 PM, Tom Evans wrote:
>
>> On Fri, May 3, 2013 at 11:04 AM, Avnesh Shakya 
>> wrote:
>> > hi, please tell me. it's urgent.
>> >
>>
>> "its urgent".
>>
>> Sorry, couldn't resist. As this seems to have nothing to do with
>> django, and a lot to do with "apscheduler", perhaps you should ask the
>> apscheduler folks instead?
>>
>> Cheers
>>
>> Tom
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users?hl=en.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to get called function automatically inside views.py?

2013-05-03 Thread Avnesh Shakya
thanks but if i want to get a function called autometically, when i run
127.0.0.1:8000/  which defined inside views.py. how is it possible.


On Fri, May 3, 2013 at 4:00 PM, Tom Evans  wrote:

> On Fri, May 3, 2013 at 11:04 AM, Avnesh Shakya 
> wrote:
> > hi, please tell me. it's urgent.
> >
>
> "its urgent".
>
> Sorry, couldn't resist. As this seems to have nothing to do with
> django, and a lot to do with "apscheduler", perhaps you should ask the
> apscheduler folks instead?
>
> Cheers
>
> Tom
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to get called function automatically inside views.py?

2013-05-03 Thread Tom Evans
On Fri, May 3, 2013 at 11:04 AM, Avnesh Shakya  wrote:
> hi, please tell me. it's urgent.
>

"its urgent".

Sorry, couldn't resist. As this seems to have nothing to do with
django, and a lot to do with "apscheduler", perhaps you should ask the
apscheduler folks instead?

Cheers

Tom

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: how to get called function automatically inside views.py?

2013-05-03 Thread Avnesh Shakya
hi, please tell me. it's urgent.

On Thursday, May 2, 2013 7:01:33 PM UTC+5:30, Avnesh Shakya wrote:
>
>
> hi,
> I am creating a function inside the views.py, I want to call this 
> function automatically according to timing which i m using through 
> apscheduler. how is it possible, please tell me.
> my views.py file
> # Create your views here.
> import simplejson as json
> from apps.learning.models import CourseCategory
> import sys
> from apscheduler.scheduler import Scheduler
> import tkMessageBox
>
>  
> sched = Scheduler() 
> sched.start()
>
>
> def JsontoMySQL():
> category_json_data = json.load(open('DataCategory.json','r'))
> tkMessageBox.showinfo(title="Greetings", message="Hello World!")
> category = CourseCategory()
> for i in range(0,len(category_json_data)-1):
> cats_id = category_json_data[i]['cats_id']
> cats_name = category_json_data[i]['cats_name']
> cats_short_name = category_json_data[i]['cats_shortname']
> category = CourseCategory(cats_id=cats_id, cats_name=cats_name, 
> cats_short_name=cats_short_name)
> category.save()
> 
> def job_function(): 
> JsontoMySQL()
>  
> sched.add_cron_job(job_function, month='1-12', day='1-31', 
> hour='0-23',minute='34-36')
>
>
> Thanks in advance.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




how to get called function automatically inside views.py?

2013-05-02 Thread Avnesh Shakya

hi,
I am creating a function inside the views.py, I want to call this 
function automatically according to timing which i m using through 
apscheduler. how is it possible, please tell me.
my views.py file
# Create your views here.
import simplejson as json
from apps.learning.models import CourseCategory
import sys
from apscheduler.scheduler import Scheduler
import tkMessageBox

 
sched = Scheduler() 
sched.start()


def JsontoMySQL():
category_json_data = json.load(open('DataCategory.json','r'))
tkMessageBox.showinfo(title="Greetings", message="Hello World!")
category = CourseCategory()
for i in range(0,len(category_json_data)-1):
cats_id = category_json_data[i]['cats_id']
cats_name = category_json_data[i]['cats_name']
cats_short_name = category_json_data[i]['cats_shortname']
category = CourseCategory(cats_id=cats_id, cats_name=cats_name, 
cats_short_name=cats_short_name)
category.save()

def job_function(): 
JsontoMySQL()
 
sched.add_cron_job(job_function, month='1-12', day='1-31', 
hour='0-23',minute='34-36')


Thanks in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.