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
                      
                      
                     
                    
                  
评论区