Skip to content

Django v.4.0 and graphene-django v.2.15.0 #1284

Closed
@hannody

Description

@hannody

Note: for support questions, please use stackoverflow. This repository's issues are reserved for feature requests and bug reports.

  • What is the current behavior?

Running Django 4.0 server fails after adding/installing graphene-django v.2.15.0 to the project.
"ImportError: cannot import name 'force_text' from 'django.utils.encoding'"

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via
    a github repo, https://repl.it or similar (you can use this template as a starting point: https://repl.it/@jkimbo/Graphene-Django-Example).

  • **Steps to reproduce:
    1- mkvirtualenv dj4
    2- pip install django
    3- django-admin startproject core .
    4- python manage.py runserver (Django server is up and running)
    5- pip install graphene-django
    6- python manage.py runserver ( ImportError: cannot import name 'force_text' from 'django.utils.encoding' (/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/utils/encoding.py)

  • What is the expected behavior?

Django server should be up and running. downgrading django to 3.2.9 will make the project works!

  • What is the motivation / use case for changing the behavior?

  • Please tell us about your environment:

    • Version: Python 3.8, Django 4.0, graphene-django v.2.15.0
    • Platform: Ubuntu 20.04
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow)

  • **Stacktrace
    $ python manage.py runserver
    Watching for file changes with StatReloader
    Exception in thread django-main-thread:
    Traceback (most recent call last):
    File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
    File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 115, in inner_run
    autoreload.raise_last_exception()
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/core/management/init.py", line 381, in execute
    autoreload.check_errors(django.setup)()
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/init.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/apps/registry.py", line 91, in populate
    app_config = AppConfig.create(entry)
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/apps/config.py", line 223, in create
    import_module(entry)
    File "/usr/lib/python3.8/importlib/init.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
    File "", line 1014, in _gcd_import
    File "", line 991, in _find_and_load
    File "", line 975, in _find_and_load_unlocked
    File "", line 671, in _load_unlocked
    File "", line 848, in exec_module
    File "", line 219, in _call_with_frames_removed
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/graphene_django/init.py", line 1, in
    from .fields import DjangoConnectionField, DjangoListField
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/graphene_django/fields.py", line 18, in
    from .utils import maybe_queryset
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/graphene_django/utils/init.py", line 2, in
    from .utils import (
    File "/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/graphene_django/utils/utils.py", line 6, in
    from django.utils.encoding import force_text
    ImportError: cannot import name 'force_text' from 'django.utils.encoding' (/home/fake_user/.virtualenvs/dj4/lib/python3.8/site-packages/django/utils/encoding.py)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions