Re: how to use Django ORM in standalone script
I would:
1. Write the script as a manage.py command.
2. Duplicate the Django install on the other machine (or at least
enough of it to cover the models that you need), making any settings
changes needed to access the correct DB (i.e.; if you're using
"localhost" to access the DB in your original server, that's got to
change on the other).
The server never needs to run on the second machine, and it doesn't
need apache, mod_wsgi, or whatever mechanism you are using to serve
pages on the first machine. But the ORM needs access to the model
definitions of the relevant apps, and it will typically be easier to
pull the whole thing than to tease out just enough. If your project
is in a suitable VCS, that is a good way to make the copy.
Bill
On 3/12/12, H.T. Wei <kkmanwei@gmail.com> wrote:
> Hi,
>
> If anyone can suggest what is the best way to use Django ORM in standalone
> script for accessing database? The "standalone script" is located on the
> server different from Django server but access the same database server.
> Thanks in advance!
>
>
> Steve
> --
> " stay hungry, stay foolish"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home