Django application which allows to run scripts using Django ORM
Python
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
run_script
.gitignore
LICENSE
README.md

README.md

django-run-script

Info

Author: Evgeny Kazanov

Introduction

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:

  1. To write scripts with less coding.
  2. To locate scripts anywhere.

System requirements

  1. Python (Script was tested with 2.7 and 2.6 versions),
  2. Django (Script was tested with 1.4 version)

Installation

  1. Copy "run_script" directory to applications directory.
  2. Add 'run_script' to INSTALLED_APPS.

Usage

manage.py run_script <script_path/script_name>

Script sample

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)