Django的Bug处理

Django的Bug处理

BUG

When I run this shell code, it will showed this error tips:

mysqlclient 1.3.13 or newer is required; you have 0.9.3.

solve

  • http://www.bubuko.com/infodetail-3040101.html

    1. Django 2.2 -> Django 2.1.4

      • find base.py and comment this code in 35 line.
      
          if version < (1, 3, 3):
              raise ImproperlyConfigured("mysqlclient 1.3.3 or newer is required; you have %s" % Database.__version__)
      
      
      • Find operations.py and changed “decode” to “encode” in 146 line.
      
          # query = query.decode(errors='replace')
          query = query.decode(errors='replace')
      
      

Coding

Create django models

  1. Create models.py in projects.

  2. Setting models in settings.py

    
        INSTALLED_APPS = [
            'polls.apps.PollsConfig',
        ]
    
    
  3. Run code in main file

    
        > python manage.py makemigrations polls
    
    
  4. Run code in main file, create tables in the mysql.

    
        > python manage.py migrate
    
    

你可能感兴趣的:(技术)