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.


Reply via email to