djangopythonanywheredjango-contrib

ImportError: No module named 'django.contrib.sessions'


This app works fine in my development environment, but on my PythonAnywhere instance there seems to be an issue with Django. Any idea what could cause this?

Traceback (most recent call last):
  File "/home/cvcexport/genius/genius/local/lib/python3.5/site-packages/django/apps/config.py", line 118, in create
    cls = getattr(mod, cls_name)
AttributeError: module 'django.contrib' has no attribute 'sessions'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/cvcexport/genius/genius/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/home/cvcexport/genius/genius/local/lib/python3.5/site-packages/django/core/management/__init__.py", line 341, in execute
    django.setup()
  File "/home/cvcexport/genius/genius/local/lib/python3.5/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/home/cvcexport/genius/genius/local/lib/python3.5/site-packages/django/apps/registry.py", line 85, in populate
    app_config = AppConfig.create(entry)
  File "/home/cvcexport/genius/genius/local/lib/python3.5/site-packages/django/apps/config.py", line 123, in create
    import_module(entry)
  File "/home/cvcexport/genius/genius/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 956, in _find_and_load_unlocked
ImportError: No module named 'django.contrib.sessions'

Solution

  • This must have been an issue with this particular version of Django (1.10.5) as updating to 1.10.8 seems to have resolved it.