Re: Support `manage.py shell -c 'run_code_as_django()'`?

2016-01-12 Thread Zach Borboa


Nice to see that this was implemented.


$ cat myscript.py
import django
print(django.__version__)

$ python manage.py shell --command="import myscript"
1.10.dev2016011210



The --command option lets you pass a command as a string to execute it as 
Django, like so:

django-admin shell --command="import django; print(django.__version__)"


https://docs.djangoproject.com/en/dev/ref/django-admin/#django-admin-option---command

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e585499f-90b7-4a55-ba61-3c59130310b3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Support `manage.py shell -c 'run_code_as_django()'`?

2015-11-11 Thread Collin Anderson
I would use this feature. It would be nice for calling a simple function.

Though if we didn't add the feature it would be nice to document the text 
piping option.

The one downside of the piping is you get a little bit of garbage in the 
output, especially when iPython is installed.

On Tuesday, 10 November 2015 00:09:27 UTC-5, Zach Borboa wrote:
>
> I've used
>
> cat script.py | python manage.py shell
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/00c51a06-5487-4e24-9fdd-039476c54493%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Support `manage.py shell -c 'run_code_as_django()'`?

2015-11-09 Thread Zach Borboa
I've used

cat script.py | python manage.py shell

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ce1f31f6-1f66-4d81-9231-a3d975a6aeb3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Support `manage.py shell -c 'run_code_as_django()'`?

2015-11-09 Thread Tim Graham
Similar to "python -c", there's been a request for:

python manage.py shell -c 'run_code_as_django()'

to avoid writing simple management commands. What do you think about this 
idea?

https://code.djangoproject.com/ticket/25680

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ec1bfcf0-8fc9-449c-a1c5-50855319f437%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.