funtion is not working in django project.

41 views
Skip to first unread message

Avnesh Shakya

unread,
May 3, 2013, 7:11:55 AM5/3/13
to apsch...@googlegroups.com
hi,
   please help me, I am unable to get solution of my problem.
I m trying to get called a function automatically which is defined inside views.py of django project.
function is --

# 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('CourseDataCategory.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 = CourseraCategory(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')


but it's not working..... please tell me.   what is problrm with it...   it's urgent.


thanks.

Alex Grönholm

unread,
May 3, 2013, 8:02:41 AM5/3/13
to apsch...@googlegroups.com
If you're so desperate, would at least tell me what error you're
getting? Anything to help me diagnose the problem?
Also, why are you not scheduling jsonToMySQL() directly?
>
>
> thanks.
> --
> You received this message because you are subscribed to the Google
> Groups "APScheduler" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to apscheduler...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Reply all
Reply to author
Forward
0 new messages