So you need to write an external script that would run outside Django and still have access to your app’s models?

Nothing could be more simple.

Python [Show Plain Code]:
  1. from django.core.management import setup_environ
  2. import settings
  3. setup_environ(settings)
  4.  
  5. from foo import models
  6.  
  7. # rest of your code…

One Response to “Writing an external script that can access your Django models”

  1. But the daemon should be in the same directory of the settings file, otherwise you have an import errore ’cause the module can’t be found.

    do you know a workaround to place the daemon in each folder you want in the filesystem?

    Thanks in advance. Please reply at my mail.

    April 2nd, 2008 | 9:26 am

Leave a Reply