Re: Help for crontab

2008-11-23 Thread R. Gorman

Here's a third option that I've found useful when wanting to run a
cron job: 
http://blog.capstrat.com/articles/making-django-environmentally-friendly/
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help for crontab

2008-11-20 Thread Ben Eliott

recommend you check out django-extensions jobs.
http://code.google.com/p/django-command-extensions/


On 20 Nov 2008, at 12:53, laspal wrote:

>
> hi,
> I am writing cron job for my application but run into problem
>
> from django.core.management import setup_environ
> import settings
> setup_environ(settings)
>
> from test.crm.models import CronEmail
>
> Basically the problem is I am not able to import any model.
>
> I tried this too:
> pathname = os.path.dirname(sys.argv[0])
> sys.path.append(os.path.abspath(pathname))
> sys.path.append(os.path.normpath(os.path.join(os.path.abspath
> (pathname), '../')))
> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
>
> but still can import any model.
>
> Thanks
> >


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Re: Help for crontab

2008-11-20 Thread Horst Gutmann

For things like that it's IMO still the best approach to write a
custom command for the manage.py, which handles all this for you :-)

http://docs.djangoproject.com/en/dev/howto/custom-management-commands/#howto-custom-management-commands

-- Horst

On Thu, Nov 20, 2008 at 1:53 PM, laspal <[EMAIL PROTECTED]> wrote:
> hi,
> I am writing cron job for my application but run into problem
>
> from django.core.management import setup_environ
> import settings
> setup_environ(settings)
>
> from test.crm.models import CronEmail
>
> Basically the problem is I am not able to import any model.
>
> I tried this too:
> pathname = os.path.dirname(sys.argv[0])
> sys.path.append(os.path.abspath(pathname))
> sys.path.append(os.path.normpath(os.path.join(os.path.abspath
> (pathname), '../')))
> os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
>
> but still can import any model.
>
> Thanks
> >
>

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---



Help for crontab

2008-11-20 Thread laspal

hi,
I am writing cron job for my application but run into problem

from django.core.management import setup_environ
import settings
setup_environ(settings)

from test.crm.models import CronEmail

Basically the problem is I am not able to import any model.

I tried this too:
pathname = os.path.dirname(sys.argv[0])
sys.path.append(os.path.abspath(pathname))
sys.path.append(os.path.normpath(os.path.join(os.path.abspath
(pathname), '../')))
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

but still can import any model.

Thanks
--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~--~~~~--~~--~--~---