You can run a django module directly if you do something like:

 

if __name__ == '__main__':

    sys.path.append( '/all/projects/one-up-from-site directory) #may not
be needed in all cases.

    os.environ['DJANGO_SETTINGS_MODULE'] = 'mds30.settings'     

 

The problem I just encountered using cron (which more experienced Unix
dudes would know) is that running as cron does not have all the same
environment variables set as when running as root.  So we used a shell
script to set the environment variables and then run the python module.
The shell script was launched by cron.

 

Having said all that, I think I like the curl solution better.  It keeps
all you code logic together and gives you the right environment.  

 

From: django-users@googlegroups.com
[mailto:django-users@googlegroups.com] On Behalf Of Praveen Krishna R
Sent: Thursday, August 04, 2011 6:43 AM
To: django-users@googlegroups.com
Subject: Re: Run an application periodically on django

 

If you are on Linux machine, you can use cron jobs to schedule the jobs.

 

When I faced such a problem what I did was, I created a view to update
my site with a secret Url. I have scheduled a cron job to call this url.
So when the view gets called (with "curl" command I'm correct), the site
gets updated. I can call this url from a browser also, anytime. There
should be definitely  better methods of doing this, like importing
django to make a standalone app or something?! I haven't tried it yet!

 

 

On djcelery, I think you need to configure RabbitMQ or something to work
with!? correct me Kenneth, if I'm wrong. 

 

On Thu, Aug 4, 2011 at 8:12 AM, Mohamed Ghoneim <ghooo.gh...@gmail.com>
wrote:

Hey guys,

 

I am new to djnago and I have heard a lot about its powerful
capabilities, so I preferred it over other web frameworks.

 

My problem is I have a webpage that its content should be updated
automatically every 30 seconds as I build an app that gets data from
another web page

and parse it and then updates my webpage.

 

My problem is how can I schedule this this app to run every 30 seconds?
and can I do this on a hosting website?

--
Mohamed Sayed Ghoneim

 

-- 
You received this message because you are subscribed to the Google
Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
<mailto:django-users%2bunsubscr...@googlegroups.com> .
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.




-- 

Thanks and Regards,

Praveen Krishna R

 

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

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

Reply via email to