For a standalone script (and django 1.7+), you'll need to add this at the 
top of your script:

import django
django.setup()

https://docs.djangoproject.com/en/1.8/ref/applications/#django.setup
https://docs.djangoproject.com/en/1.8/intro/tutorial01/#playing-with-the-api



On Friday, July 17, 2015 at 5:30:14 PM UTC-4, Gergely Polonkai wrote:
>
> I think what you really need is a custom Django management command. You 
> can take a look at the implementation of createsuperuser, it takes some 
> input and creates a user based on this info.
> On 17 Jul 2015 18:55, "Jake Rudolph" <[email protected] <javascript:>> 
> wrote:
>
>> So basically I have my Django app that takes in information from a user 
>> to make new objects, and I need to send some of that information to a 
>> separate script that performs logic and such with that information. When 
>> certain events occur I need to send information from the script to the 
>> database.
>>
>> On Friday, July 17, 2015 at 5:12:51 AM UTC-7, [email protected] wrote:
>>>
>>> On Thu, Jul 16, 2015 at 7:44 PM, Jake Rudolph <[email protected]> 
>>> wrote: 
>>> > If I have a separate Python script that I want to interact with my 
>>> Django 
>>> > project, how do I set them up to communicate? 
>>>
>>> Not 100% sure what you mean. Do you mean you want to have a standalone 
>>> python script that uses the ORM? I do this all the time. Just import 
>>> what you need. 
>>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> To post to this group, send email to [email protected] 
>> <javascript:>.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-users/068b19ed-fdab-430b-8ae6-01cbb92321b7%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/django-users/068b19ed-fdab-430b-8ae6-01cbb92321b7%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/15e9d517-15d6-4c47-99a2-4174966180b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to