"/>
侧边栏壁纸
博主头像
PySuper 博主等级

千里之行,始于足下

  • 累计撰写 218 篇文章
  • 累计创建 15 个标签
  • 累计收到 2 条评论

目 录CONTENT

文章目录
Web

DjangoWeb 版本升级

PySuper
2020-07-07 / 0 评论 / 0 点赞 / 37 阅读 / 0 字
温馨提示:
本文最后更新于2024-05-28,若内容或图片失效,请留言反馈。 所有牛逼的人都有一段苦逼的岁月。 但是你只要像SB一样去坚持,终将牛逼!!! ✊✊✊

Django版本升级中的Bug

  • pip install django==2.2.2,不要直接就django2.2
  • Did you install mysqlclient?
    在settings中,添加__init__.py
import pymysql
pymysql.install_as_MySQLdb()
  • mysqlclient 1.3.13 or newer is required; you have 0.9.3.:修改django/db/backends/mysql/base.py
# if version < (1, 3, 13):
#     raise ImproperlyConfigured('mysqlclient 1.3.13 or newer is required; you have %s.' % Database.__version__)
  • AUTH_USER_MODEL refers to model 'users.User' that has not been installed
  • AttributeError: 'str' object has no attribute 'decode'
    修改site-packages/django/db/backends/mysql/operations.py
    def last_executed_query(self, cursor, sql, params):
        # With MySQLdb, cursor objects have an (undocumented) "_executed"
        # attribute where the exact query sent to the database is saved.
        # See MySQLdb/cursors.py in the source distribution.
        query = getattr(cursor, '_executed', None)
        if query is not None:
            query = query.encode(errors='replace')
        return query

Linux下的Python版本升级

-- 下载
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz

-- 解压
tar  -xf    ***.gz

-- 编译
./configure && make && make install

-- 软链接
ln -s /usr/local/bin/python3.7 /usr/bin/python
ln -s /usr/local/bin/python3.7-config /usr/bin/python-config
0
  1. 支付宝打赏

    qrcode alipay
  2. 微信打赏

    qrcode weixin

评论区