Author: Evgeny Kazanov
Sometimes it is very usefull to run python scripts which use Django ORM. This application allows to do it from command line.
The similar functionality there is in django-extensions, but this script allows:
- To write scripts with less coding.
- To locate scripts anywhere.
- Python (Script was tested with 2.7 and 2.6 versions),
- Django (Script was tested with 1.4 version)
- Copy "run_script" directory to applications directory.
- Add 'run_script' to INSTALLED_APPS.
manage.py run_script <script_path/script_name>
from your_application.models import YourModelClass` for o in YourModelClass.objects.all(): try: print o.id, print o.some_field except Exception, e: print "an error = ",str(e)