I've got a script which reads data from the csv file. I have to keep data right into a database which was already produced as

$ python manage.py syncdb

so, that automated data entry can be done within an simpler manner, as obtainable in the django spend.

You need to setup a django atmosphere to make use of inside your script, later on your python script can function with django models just as with the 'real' site:

The simplest method of doing this: set the DJANGO_Configurations_MODULE atmosphere variable (e.g. export DJANGO_SETTINGS_MODULE=mysite.settings ). Your script can perform such things as:

from app.models import MyModel

a = MyModel(field=value)

You will find several different ways, where you need to write some additional code inside your script, I favor these as they do not require an atmosphere variable:

1) setup_environ:

from django.core.management import setup_environ
import mysite.settings

2) Create configurations around the flow:

from django.conf import settings
settings.configure(DEBUG=False, DATABASE_NAME="mydb", ...)