Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Needs Django 4.0 integration #39

Closed
tulgaab opened this issue Mar 24, 2022 · 8 comments
Closed

Needs Django 4.0 integration #39

tulgaab opened this issue Mar 24, 2022 · 8 comments

Comments

@tulgaab
Copy link

tulgaab commented Mar 24, 2022

Can't use django-admin-charts on Django 4.x version.

ImportError: cannot import name 'smart_text' from 'django.utils.encoding' (/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/utils/encoding.py)

@PetrDlouhy
Copy link
Owner

Which version of django-admin-charts do you use?
Can you please post full stacktrace?

The problem is probably in the dependency django-cache-utils, which wasn't updated yet to Django 4.0.
You can install compatible version with pip install git+https://github.com/PetrDlouhy/django-cache-utils@django40

@tulgaab
Copy link
Author

tulgaab commented Mar 24, 2022

I'm using django-admin-charts-1.0.0
Full stack trace:

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    autoreload.raise_last_exception()
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/utils/autoreload.py", line 87, in raise_last_exception
    raise _exception[1]
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/core/management/__init__.py", line 398, in execute
    autoreload.check_errors(django.setup)()
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/apps/registry.py", line 116, in populate
    app_config.import_models()
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/apps/config.py", line 304, in import_models
    self.models_module = import_module(models_module_name)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/admin_tools_stats/models.py", line 24, in <module>
    from cache_utils.decorators import cached
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/cache_utils/decorators.py", line 8, in <module>
    from cache_utils.utils import _cache_key, _func_info, _func_type, sanitize_memcached_key
  File "/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/cache_utils/utils.py", line 3, in <module>
    from django.utils.encoding import smart_text
ImportError: cannot import name 'smart_text' from 'django.utils.encoding' (/Users/khureltulga/Documents/GitHub/everestsso/.env/lib/python3.8/site-packages/django/utils/encoding.py)

and can't install django-cache-utils@django40

Collecting git+https://github.com/PetrDlouhy/django-cache-utils@django40
  Cloning https://github.com/PetrDlouhy/django-cache-utils (to revision django40) to /private/var/folders/3y/p9br2vc92h1gyq1ct83rrxlw0000gp/T/pip-req-build-o0r_iwki
  Running command git clone --filter=blob:none --quiet https://github.com/PetrDlouhy/django-cache-utils /private/var/folders/3y/p9br2vc92h1gyq1ct83rrxlw0000gp/T/pip-req-build-o0r_iwki
  fatal: unable to access 'https://github.com/PetrDlouhy/django-cache-utils/': error:02FFF036:system library:func(4095):Connection reset by peer
  error: subprocess-exited-with-error
  
  × git clone --filter=blob:none --quiet https://github.com/PetrDlouhy/django-cache-utils /private/var/folders/3y/p9br2vc92h1gyq1ct83rrxlw0000gp/T/pip-req-build-o0r_iwki did not run successfully.
  │ exit code: 128
  ╰─> See above for output.
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× git clone --filter=blob:none --quiet https://github.com/PetrDlouhy/django-cache-utils /private/var/folders/3y/p9br2vc92h1gyq1ct83rrxlw0000gp/T/pip-req-build-o0r_iwki did not run successfully.
│ exit code: 128
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

@PetrDlouhy
Copy link
Owner

@tulgaab The error comes clearly from django-cache-utils.
The inability to install django-cache-utils@django40 comes from this network error:
fatal: unable to access 'https://github.com/PetrDlouhy/django-cache-utils/': error:02FFF036:system library:func(4095):Connection reset by peer

Seems that something is blocking your network, I did try the exact command and it works for me.

Please refer to infoscout/django-cache-utils#29 for further info.

@gishamohebi
Copy link

Hello
I have a problem, I installed the package you mentioned above but it returns the blank diagrams to me. What should I do?

@PetrDlouhy
Copy link
Owner

Check your Dashboard stats setting, check browser developers console for errors. Check if there is any data for the charts to be displayed.

I really can't tell anything without any information about the problem at all. Please send screenshots of the charts and your configuration.

@gishamohebi
Copy link

gishamohebi commented Mar 27, 2022 via email

@PetrDlouhy
Copy link
Owner

Hi @gishamohebi,

I don't think, that the attachments will be posted to GitHub through if you send them as e-mail reply. I don't see anything here. Please post them as comment here.

@PetrDlouhy
Copy link
Owner

I have migrated the project from django-cache-utils to django-memoize and release new version.
Now it should everything work with newest Django out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants