You can add the following lines in your script:

`
import django
sys.path.append('<your_django_directory>')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', '<your_django_settings>')
django.setup()
`

On Tue, 7 Jun 2022 at 04:17, Jason <[email protected]> wrote:

> Why?  what's the purpose behind this?
>
> On Monday, June 6, 2022 at 12:27:58 PM UTC-4 [email protected] wrote:
>
>> How replace "./manage.py < some_code.py" with "./some_code.py" for
>> website scripts?
>>
>> There seem to be a number of imports needed to make the 2nd version work.
>>
>> cs
>>
> --
> 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 view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/72eaa595-0d6c-44d3-a612-4776b0624c6dn%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/72eaa595-0d6c-44d3-a612-4776b0624c6dn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFKhtoRu-3XiM4-n5hNzKi2dE3sKfQ47kf7y%3DgzVHZZxo%3DvAoA%40mail.gmail.com.

Reply via email to