django-extensions

What is the way to set ipython notebook server parameters when running notebook with django-extensions?

心已入冬 提交于 2020-08-24 08:53:40
问题 I am using the following command to run an ipython notebook server with django: ./manage.py shell_plus --notebook The server functions as expected. However, I would like to set the port and not launch a browser when starting the server. If I were running an IPython notebook server without django I successfully use the following: ipython notebook --port=9999 --no-browser I checked the documentation here and tried setting the options using IPYTHON_ARGUMENTS = [ '--ext', 'django_extensions

Hide SQL statements when running IPython notebook with Django's django-extensions

无人久伴 提交于 2019-12-24 00:47:28
问题 I'm using Django's django-extensions to run an iPython notebook with access to the Django models (as detailed here http://andrewbrookins.com/python/using-ipython-notebook-with-django/). When I make model queries, the notebook shows the underlying SQL queries executed by Django, like so: Can I hide this SQL? It's so voluminous it makes the display unusable at times. 回答1: with recent version, you could use %%capture variable the code to capture stdout and stderr into a variable adding the --no

Passing command line arguments in django runscript

拟墨画扇 提交于 2019-12-12 01:51:43
问题 Is there a way to pass command line arguments to a script using django runscript ? The script I am trying to run uses argparse to accept command line arguments. Command line execution of the script: ./consumer --arg1 arg1 --arg2 arg2 Both arg1 and arg2 are required options. We tried using script-args but unable to figure out how to use it in this context. 回答1: Take a look at Django's Commands class Command(BaseCommand): def add_arguments(self, parser): parser.add_argument('--arg1', help=

shell_plus installed with Django giving error - ImportError: cannot import name 'Type

为君一笑 提交于 2019-12-11 08:14:05
问题 I am getting the following error when trying to launch shell_plus after installing django_extensions. Here are the steps i followed 1-Installed django_extensions using pip install django_extensions 2-Added django_extensions to installed apps Then I get the following error $ ./manage.py shell_plus Traceback (most recent call last): File "./manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/Users/admin/Development/project/virtual/lib/python3.5/site-packages/django/core

Print sql queries in jupyter notebook with django-extensions plugin

蹲街弑〆低调 提交于 2019-11-30 09:34:20
问题 Is it possible to show SQL queries like in this command: python manage.py shell_plus --print-sql but in Jupyter Notebook? I tried this command python manage.py shell_plus --notebook --print-sql but it not worked. 回答1: It's probably a bug in Django Extensions that you don't see SQL queries. A few versions ago, someone asked here how to disable SQL printing in Jupyter. As a workaround, you could use django_print_sql: from django_print_sql import print_sql with print_sql(count_only=False): User

Print sql queries in jupyter notebook with django-extensions plugin

不打扰是莪最后的温柔 提交于 2019-11-29 16:11:53
Is it possible to show SQL queries like in this command: python manage.py shell_plus --print-sql but in Jupyter Notebook? I tried this command python manage.py shell_plus --notebook --print-sql but it not worked. It's probably a bug in Django Extensions that you don't see SQL queries. A few versions ago, someone asked here how to disable SQL printing in Jupyter. As a workaround, you could use django_print_sql : from django_print_sql import print_sql with print_sql(count_only=False): User.objects.count() You may even find that having control over which queries to print is preferable to printing