zoukankan      html  css  js  c++  java
  • django 报错集锦

     
                                                <span id="OSC_h2_1"></span>
    • 1

    1、ImportError: No module named ‘DjangoUeditor’

    出错原因:安装DjangoUeditor库适用于python2,需要下载适用python3的

    下载地址:https://github.com/twz915/DjangoUeditor3

    2、python3的环境安装xadmin时,UnicodeDecodeError: ‘gbk’ codec can’t decode byte 0xa4

    README.rst这个文件的编码有问题,可以内容没什么重要的,可以直接到github上下载安装包
    下载安装包,下载zip压缩文件,下载地址:https://github.com/sshwsfc/xadmin

    新建一个txt空文件,把文件名改成README.rst,替换原来的文件 

    注意:目录下有个requirements.txt文件,如果安装过django文件并对版本有要求,这里可以删除掉

    django-crispy-forms>=1.6.0
    django-import-export>=0.5.1
    django-reversion>=2.0.0
    django-formtools>=2.0
    future==0.15.2
    httplib2==0.9.2
    six==1.10.0
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7

    django-formtools默认为1.0,安装有时候会报错,需要django-formtools>=2.0版本升级2以上

    替换成功后把完整的压缩包放在pip目录下

    执行命令行

    pip install C:UsersxianmengxuanlingDesktopxadmin-master.zip
    • 1

    3、RuntimeError: Model class django.contrib.admin.models.LogEntry doesn’t declare an explicit app_label and isn’t in an application in INSTALLED_APPS.

    settings.py里加入

    INSTALLED_APPS = [
        'django.contrib.auth',
        'django.contrib.admin',
    
    ]
    • 1
    • 2
    • 3
    • 4
    • 5

    4.django.db.utils.OperationalError: (1193, “Unknown system variable ‘storage_engine’”)

    django连接数据库时,配置

    "OPTIONS":{"init_command":"SET storage_engine=INNODB;"}
    • 1

    如果mysql数据库的版本是5.6,这句话会抛出如下异常

    django.db.utils.OperationalError: (1193, "Unknown system variable 'storage_engine'")
    • 1

    解决办法

    "OPTIONS":{"init_command":"SET default_storage_engine=INNODB;"}
    • 1

    5.启动服务之后,跳出弹框“位于api的服务器127.0.0.1要求用户名密码”

    添加应用设置

    runserver 0.0.0.0:8000
    • 1

  • 相关阅读:
    CS round--36
    Vijos 1002 过河 dp + 思维
    汇编模拟36选7
    1137
    E. Mike and Foam 容斥原理
    Even-odd Boxes hackerrank 分类讨论
    112. 作业之地理篇 最小费用最大流模板题
    1550: Simple String 最大流解法
    Sam's Numbers 矩阵快速幂优化dp
    java.sql.SQLSyntaxErrorException: ORA-01722: 无效数字
  • 原文地址:https://www.cnblogs.com/longfeiwang/p/11085406.html
Copyright © 2011-2022 走看看