#30352 closed Cleanup/optimization (needsinfo)
Error al ejecutar python manage.py sin sealizar cambios
Reported by: | irv-ro-j | Owned by: | nobody |
---|---|---|---|
Component: | Core (System checks) | Version: | 2.2 |
Severity: | Normal | Keywords: | Reload Django |
Cc: | Scott Talbert, Alexandru Chirila, Akos Ladanyi, Will Hawkins | Triage Stage: | Unreviewed |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
El error se puede generar presionando "Ctrl + S" para recargar Django y no es necesario realizar algún cambio en el código para obtener el error que parece ser aleatorio. Por lo pronto lo solucioné regresando a Django 2.1.4
Algunas veces funciona bien e informa lo siguiente:
System check identified no issues (0 silenced). April 11, 2019 - 19:29:25 Django version 2.1.4, using settings 'base.settings' Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
En ocasiones pasa lo siguiente y es muy repetitivo:
/home/irvin/Documentos/Proyectos/REST-env/base/snippets/views.py changed, reloading. Watching for file changes with StatReloader Performing system checks... Exception in thread Thread-1: Traceback (most recent call last): File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/utils.py", line 66, in __getitem__ return self._engines[alias] KeyError: 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/contrib/admin/checks.py", line 80, in check_dependencies for engine in engines.all(): File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/utils.py", line 90, in all return [self[alias] for alias in self] File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/utils.py", line 90, in <listcomp> return [self[alias] for alias in self] File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/utils.py", line 81, in __getitem__ engine = engine_cls(params) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/backends/django.py", line 25, in __init__ options['libraries'] = self.get_templatetag_libraries(libraries) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries libraries = get_installed_libraries() File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries for name in get_package_libraries(pkg): File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/template/backends/django.py", line 121, in get_package_libraries module = import_module(entry[1]) File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/rest_framework/templatetags/rest_framework.py", line 15, in <module> from rest_framework.renderers import HTMLFormRenderer File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/rest_framework/renderers.py", line 20, in <module> from django.test.client import encode_multipart File "/home/irvin/Documentos/Proyectos/REST-env/lib/python3.6/site-packages/django/test/client.py", line 23, in <module> from django.test import signals File "<frozen importlib._bootstrap>", line 968, in _find_and_load File "<frozen importlib._bootstrap>", line 149, in __enter__ File "<frozen importlib._bootstrap>", line 94, in acquire _frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 140476939476608
SO Ubuntu 18
Componentes instalados:
Python 3.6.7
Django 2.2
django-crispy-forms 1.7.2
django-environ 0.4.5
django-filter 2.1.0
django-smart-selects 1.5.4
django-tables2 2.0.6
django-widget-tweaks 1.4.3
djangorestframework 3.9.2
Markdown 3.1
numpy 1.16.2
pip 19.0.3
pkg-resources 0.0.0
psycopg2-binary 2.8.1
Pygments 2.3.1
pytz 2019.1
setuptools 41.0.0
sqlparse 0.3.0
table 0.0.4
wheel 0.33.1
Change History (16)
comment:1 by , 6 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
comment:2 by , 6 years ago
Resolution: | worksforme |
---|---|
Status: | closed → new |
I'm seeing the same issue apparently (although I don't understand Spanish well):
Watching for file changes with StatReloader Performing system checks... Exception in thread Thread-1: Traceback (most recent call last): File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/utils.py", line 66, in __getitem__ return self._engines[alias] KeyError: 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/usr/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/contrib/admin/checks.py", line 80, in check_dependencies for engine in engines.all(): File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/utils.py", line 90, in all return [self[alias] for alias in self] File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/utils.py", line 90, in <listcomp> return [self[alias] for alias in self] File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/utils.py", line 81, in __getitem__ engine = engine_cls(params) File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/backends/django.py", line 25, in __init__ options['libraries'] = self.get_templatetag_libraries(libraries) File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries libraries = get_installed_libraries() File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries for name in get_package_libraries(pkg): File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/template/backends/django.py", line 121, in get_package_libraries module = import_module(entry[1]) File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "<home_dir>/rest_api/env/lib/python3.6/site-packages/rest_framework/templatetags/rest_framework.py", line 15, in <module> from rest_framework.renderers import HTMLFormRenderer File "<home_dir>/rest_api/env/lib/python3.6/site-packages/rest_framework/renderers.py", line 20, in <module> from django.test.client import encode_multipart File "<home_dir>/rest_api/env/lib/python3.6/site-packages/django/test/client.py", line 23, in <module> from django.test import signals File "<frozen importlib._bootstrap>", line 968, in _find_and_load File "<frozen importlib._bootstrap>", line 149, in __enter__ File "<frozen importlib._bootstrap>", line 94, in acquire _frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 140466248423072
My packages list is a bit shorter:
certifi==2019.3.9 chardet==3.0.4 colorama==0.4.1 Django==2.2 djangorestframework==3.9.2 future==0.17.1 h2o==3.22.1.5 idna==2.8 numpy==1.16.2 pandas==0.24.2 pkg-resources==0.0.0 python-dateutil==2.8.0 pytz==2018.9 requests==2.21.0 six==1.12.0 sqlparse==0.3.0 tabulate==0.8.3 urllib3==1.24.1
comment:3 by , 6 years ago
Everything works for me :| Can you provide test project to reproduce this issue?
comment:4 by , 6 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
comment:5 by , 6 years ago
Cc: | added |
---|
In my case, it seems that somehow one or more of the '.pyc' files in my venv had gotten corrupted somehow. I deleted all the '.pyc' files in my venv and now I can no longer reproduce the problem.
comment:6 by , 6 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
I got the same issue. I tried to delete all .pyc. However, the problem still exists.
I'm not sure what the problem is.
OS: OSX
Python: Python 3.7.1
Django==2.2.1
djangorestframework==3.9.4
Pygments==2.4.1
pytz==2019.1
sqlparse==0.3.0
comment:7 by , 6 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Please follow triaging guidelines with regards to needsinfo tickets. To reopen this ticket you should provide a test project.
comment:8 by , 6 years ago
Cc: | added |
---|
comment:9 by , 6 years ago
Cc: | added |
---|
comment:10 by , 5 years ago
Resolution: | needsinfo |
---|---|
Status: | closed → new |
There is no resolution for this issue yet. The issue is still there and cannot be easily reproduced.
[INFO] 2019-08-15 09:43:46,548 django.utils.autoreload (autoreload.py:597) - Watching for file changes with StatReloader Performing system checks... Exception in thread django-main-thread: Traceback (most recent call last): File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/utils.py", line 66, in __getitem__ return self._engines[alias] KeyError: 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/opt/python/3.6.7/lib/python3.6/threading.py", line 916, in _bootstrap_inner self.run() File "/opt/python/3.6.7/lib/python3.6/threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/utils/autoreload.py", line 54, in wrapper fn(*args, **kwargs) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run self.check(display_num_errors=True) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/core/management/base.py", line 390, in check include_deployment_checks=include_deployment_checks, File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/core/management/base.py", line 377, in _run_checks return checks.run_checks(**kwargs) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/core/checks/registry.py", line 72, in run_checks new_errors = check(app_configs=app_configs) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/contrib/admin/checks.py", line 79, in check_dependencies for engine in engines.all(): File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/utils.py", line 90, in all return [self[alias] for alias in self] File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/utils.py", line 90, in <listcomp> return [self[alias] for alias in self] File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/utils.py", line 81, in __getitem__ engine = engine_cls(params) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/backends/django.py", line 25, in __init__ options['libraries'] = self.get_templatetag_libraries(libraries) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/backends/django.py", line 43, in get_templatetag_libraries libraries = get_installed_libraries() File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/backends/django.py", line 108, in get_installed_libraries for name in get_package_libraries(pkg): File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/template/backends/django.py", line 121, in get_package_libraries module = import_module(entry[1]) File "/home/travis/virtualenv/python3.6.7/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 994, in _gcd_import File "<frozen importlib._bootstrap>", line 971, in _find_and_load File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 665, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rest_framework/templatetags/rest_framework.py", line 12, in <module> from rest_framework.renderers import HTMLFormRenderer File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/rest_framework/renderers.py", line 19, in <module> from django.test.client import encode_multipart File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/django/test/client.py", line 23, in <module> from django.test import signals File "<frozen importlib._bootstrap>", line 968, in _find_and_load File "<frozen importlib._bootstrap>", line 149, in __enter__ File "<frozen importlib._bootstrap>", line 94, in acquire _frozen_importlib._DeadlockError: deadlock detected by _ModuleLock('django.test.signals') at 139722400476576
comment:11 by , 5 years ago
Resolution: | → needsinfo |
---|---|
Status: | new → closed |
Please follow triaging guidelines with regards to needsinfo tickets. To reopen this ticket you should provide a test project.
comment:12 by , 5 years ago
FWIW, I'm seeing this error too. It happens to me after code has been changed and it's trying to reload, likely while a request is being served. I'm running the default dev server, django 2.2.3, on python 3.7.1.
comment:13 by , 5 years ago
I, too, had this exact same problem. It was the result of having pyc files that were out of date. The problem bit us specifically in the context of a rebuild in a docker container. Simply removing the pyc files made this go away. I know it sounds unlikely, but it's true. I hope that helps.
Will
comment:14 by , 5 years ago
Cc: | added |
---|
comment:16 by , 3 years ago
See https://github.com/encode/django-rest-framework/issues/7078
Upgrading django-rest-framework to >= 3.11 should mitigate this.
Thanks for the report, however I cannot reproduce this issue. You should take into account that not all 3rd party packages that you mentioned in a ticket description support Django 2.2, e.g.
django-environ
.Please use one of support channels.