You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The normal process for running a Django application while developing it is to run python manage.py runserver, which runs a development server until the user hits Ctrl+C to end that server.
Ideally, I would be able to run scalene manage.py runserver, run some tests, hit Ctrl+C and have scalene report on everything that happened during that session.
Currently, running scalene manage.py runserver does not keep the server running and just stops the process.
There is a workaround to this issue (see below), so documenting rather than fixing may be sufficient.
To Reproduce
Here are the steps to reproduce using an implementation of a Django app from their official tutorial:
git clone https://github.com/devmahmud/Django-Poll-App
cd Django-Poll-App
# activate a virtualenv, if you want
pip install django scalene
python manage.py makemigrations && python manage.py migrate # setup sqlite database# runs server successfully (see at http://127.0.0.1:8000/)
python manage.py runserver
# process doesn't keep running
scalene manage.py runserver
Expected behavior
Ideally, I would be able to run scalene manage.py runserver, run some tests, hit Ctrl+C and have scalene report on everything that happened during that session.
Screenshots
Here are the logs from both calls
Django-Poll-App on master 🐍 v3.9.4 via 🅒 Django-Poll-App
❯ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...
System check identified some issues:
WARNINGS:
polls.Choice: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the PollsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
polls.Poll: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the PollsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
polls.Vote: (models.W042) Auto-created primary key used when not defining a primary key type, by default 'django.db.models.AutoField'.
HINT: Configure the DEFAULT_AUTO_FIELD setting or the PollsConfig.default_auto_field attribute to point to a subclass of AutoField, e.g. 'django.db.models.BigAutoField'.
System check identified 3 issues (0 silenced).
May 04, 2021 - 01:21:49
Django version 3.2, using settings 'pollme.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
[04/May/2021 01:21:56] "GET / HTTP/1.1" 200 2880
[04/May/2021 01:21:57] "GET /static/css/home_style.css HTTP/1.1" 200 280
[04/May/2021 01:21:57] "GET /static/img/background.jpg HTTP/1.1" 200 2910796
Not Found: /favicon.ico
[04/May/2021 01:21:57] "GET /favicon.ico HTTP/1.1" 404 2323
^C%
Desktop (please complete the following information):
OS: MacOS
Version 10.15.7
WORKAROUND
There is a workaround, and maybe it is just worth documenting it. If you pass the --noreload option, things work as expected.
It may be the case that the Django autoreload functionality causes this problem because the main django work happens on a Daemon thread if --noreload is not passed (not clear if there are alsoe additional subprocesses, but this seemed to be the case in my testing):
Describe the bug
The normal process for running a Django application while developing it is to run
python manage.py runserver
, which runs a development server until the user hitsCtrl+C
to end that server.Ideally, I would be able to run
scalene manage.py runserver
, run some tests, hitCtrl+C
and have scalene report on everything that happened during that session.Currently, running
scalene manage.py runserver
does not keep the server running and just stops the process.There is a workaround to this issue (see below), so documenting rather than fixing may be sufficient.
To Reproduce
Here are the steps to reproduce using an implementation of a Django app from their official tutorial:
Expected behavior
Ideally, I would be able to run
scalene manage.py runserver
, run some tests, hitCtrl+C
and have scalene report on everything that happened during that session.Screenshots
Here are the logs from both calls
Desktop (please complete the following information):
WORKAROUND
There is a workaround, and maybe it is just worth documenting it. If you pass the
--noreload
option, things work as expected.It may be the case that the Django autoreload functionality causes this problem because the main django work happens on a Daemon thread if
--noreload
is not passed (not clear if there are alsoe additional subprocesses, but this seemed to be the case in my testing):https://github.com/django/django/blob/ca9872905559026af82000e46cde6f7dedc897b6/django/utils/autoreload.py#L611-L614
The text was updated successfully, but these errors were encountered: