On 06/09/2011 07:50 AM, Sherif Shehab Aldin wrote:
Actually that's what am doing, am saving the files with timestamp, The question is, do I create a daemon to check the dir and process new files in order, and if that's the best practice, how do I use Django environment in the daemon so I can import the models??

A daemon is probably the best way because that way you don't have to figure out whether another instance of the process is running each time.

If you want a script to be able to import models all you have to do is have your Django settings file known by your environment.

Either set this environment variable: DJANGO_SETTINGS_MODULE

    example (must be on PYTHONPATH, of course):
        export DJANGO_SETTINGS_MODULE=myproject.settings

Or (in the script itself):

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


That stuff is explained in detail here:
https://docs.djangoproject.com/en/1.3/topics/settings/


--
You received this message because you are subscribed to the Google Groups "Django 
users" group.
To post to this group, send email to [email protected].
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.

Reply via email to