Bugs: cannot start runserver since Django 2.2.2

288 views
Skip to first unread message

Bob Voorneveld

unread,
Jun 5, 2019, 9:37:26 AM6/5/19
to Django users
Since the security fix there were 2 problems:

The package cryptography is required (wasn't before updating the pip package). I'm running Django 2.2.2 with Daphne 2.3.0. See stacktrace:

Loading .env environment variables
[05/Jun/2019 15:05:43] INFO [django.utils.autoreload:584] Watching for file changes with StatReloader
Exception in thread django-main-thread:
Traceback (most recent call last):
 
File "/usr/local/lib/python3.7/threading.py", line 917, in _bootstrap_inner
   
self.run()
 
File "/usr/local/lib/python3.7/threading.py", line 865, in run
   
self._target(*self._args, **self._kwargs)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn
(*args, **kwargs)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
    autoreload
.raise_last_exception()
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 77, in raise_last_exception
   
raise _exception[1]
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/__init__.py", line 337, in execute
    autoreload
.check_errors(django.setup)()
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 54, in wrapper
    fn
(*args, **kwargs)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/__init__.py", line 24, in setup
    apps
.populate(settings.INSTALLED_APPS)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/apps/registry.py", line 91, in populate
    app_config
= AppConfig.create(entry)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/apps/config.py", line 116, in create
    mod
= import_module(mod_path)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/importlib/__init__.py", line 127, in import_module
   
return _bootstrap._gcd_import(name[level:], package, level)
 
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
 
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
 
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
 
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
 
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
 
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/channels/apps.py", line 6, in <module>
   
import daphne.server
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/daphne/server.py", line 32, in <module>
   
from .ws_protocol import WebSocketFactory
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/daphne/ws_protocol.py", line 6, in <module>
   
from autobahn.twisted.websocket import (
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/autobahn/twisted/__init__.py", line 58, in <module>
   
from autobahn.twisted.wamp import ApplicationSession
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/autobahn/twisted/wamp.py", line 50, in <module>
   
from autobahn.wamp import protocol, auth
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/autobahn/wamp/auth.py", line 43, in <module>
   
from cryptography.hazmat.primitives.kdf.pbkdf2 import PBKDF2HMAC
ModuleNotFoundError: No module named 'cryptography'




Installing the package fixed the above, but couldn't find any required dependencies for the package?

Another one is that starting runserver, it crashes immediately. This is the stacktrace. Maybe something broke with StatReloader? I'm running Django in a docker-compose environment.

As a workaround I reverted back to Django 2.2.1, please let me know how the latest problem can be mitigated. And I'm curious how cryptography is suddenly required.

Loading .env environment variables
[05/Jun/2019 15:28:12] INFO [django.utils.autoreload:584] Watching for file changes with StatReloader
Performing system checks...
Traceback (most recent call last):

 
File "manage.py", line 15, in <module>
    execute_from_command_line
(sys.argv)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
    utility
.execute()
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
   
self.fetch_command(subcommand).run_from_argv(self.argv)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/base.py", line 323, in run_from_argv
   
self.execute(*args, **cmd_options)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 60, in execute
   
super().execute(*args, **options)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/base.py", line 364, in execute
    output
= self.handle(*args, **options)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/channels/management/commands/runserver.py", line 59, in handle
   
super().handle(*args, **options)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 95, in handle
   
self.run(**options)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/core/management/commands/runserver.py", line 102, in run
    autoreload
.run_with_reloader(self.inner_run, **options)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 585, in run_with_reloader
    start_django
(reloader, main_func, *args, **kwargs)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 570, in start_django
    reloader
.run(django_main_thread)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 288, in run
   
self.run_loop()
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 294, in run_loop
   
next(ticker)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 334, in tick
   
for filepath, mtime in self.snapshot_files():
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 350, in snapshot_files
   
for file in self.watched_files():
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 249, in watched_files
   
yield from iter_all_python_module_files()
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 103, in iter_all_python_module_files
   
return iter_modules_and_files(modules, frozenset(_error_files))
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/django/utils/autoreload.py", line 120, in iter_modules_and_files
    sys_file_paths
.append(module.__file__)
AttributeError: module '__main__' has no attribute '__file__'


If you suspect this is an IPython bug, please report it at:
    https
://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org


You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it
.


Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
   
%config Application.verbose_crash=True


Error in atexit._run_exitfuncs:
Traceback (most recent call last):
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/IPython/core/history.py", line 780, in writeout_cache
   
self._writeout_input_cache(conn)
 
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/IPython/core/history.py", line 764, in _writeout_input_cache
   
(self.session_number,)+line)
sqlite3
.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 140317622679296 and this is thread id 140318198236928.

Ramiro Morales

unread,
Jun 5, 2019, 9:49:43 AM6/5/19
to django...@googlegroups.com

Hi Bob,

Are you sure aren't Autobahn and/or Twisted (or any another lib) being upgraded at the same time?
From the look of the traceback it seems there is a sizeable list of chained dependencies and it shows clearly cryptography is being actually imported from autobahn.

--
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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/293d54e9-64f4-47d8-81f5-9624ac806a07%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Ramiro Morales
@ramiromorales

Bob Voorneveld

unread,
Jun 5, 2019, 10:25:11 AM6/5/19
to django...@googlegroups.com
Autobah is a dependancy of channels-redis==2.4.0. I saw that somehow by accident I updated that dependency and that gave me the problem:


Leaves the problem of StatReloader...


  
File "/home/docker/.local/share/virtualenvs/dropper-TxELQAPU/lib/python3.7/site-packages/channels/management/commands/runserver.py", line 59,in handle
    
super().handle(*args, **options)
You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/bxc64U85dJI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.

To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
Reply all
Reply to author
Forward
0 new messages