简体   繁体   English

Django命中计数导入错误

[英]Django Hit Count ImportError

I am trying to use the django hitcount, and I am following the only tutorial out there for it https://django-hitcount.readthedocs.io/en/latest/installation.html , and I am getting stuck on step 2--adding hitcount to the list of installed apps.我正在尝试使用 django hitcount,并且我正在遵循唯一的教程https://django-hitcount.readthedocs.io/en/latest/installation.html ,我陷入了第 2 步--将 hitcount 添加到已安装的应用程序列表中。 When I do that, and try and run the server, I get the following error:当我这样做并尝试运行服务器时,我收到以下错误:

ImportError: cannot import name 'python_2_unicode_compatible' from 'django.utils.encoding'

settings.py设置.py

INSTALLED_APPS = [
    'hitcount',
    'auctionitem.apps.AuctionitemConfig',
    'blog.apps.BlogConfig',
    'users.apps.UsersConfig',
    'crispy_forms',
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
]

Why!为什么!

最新版本的 django-hitcount 现在支持 Django 3.x。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM