weixin_46267056
鞋狗不是我
采纳率100%
2021-05-09 08:36 阅读 20

Django在终端创建迁移 文件时发生unicode错误怎么办?

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    main()
  File "manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "D:\pycharm_anzhuang\learning_log\ll_env\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "D:\pycharm_anzhuang\learning_log\ll_env\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    django.setup()
  File "D:\pycharm_anzhuang\learning_log\ll_env\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "D:\pycharm_anzhuang\learning_log\ll_env\lib\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "D:\pycharm_anzhuang\learning_log\ll_env\lib\site-packages\django\apps\config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.8_3.8.2288.0_x64__qbz5n2kfra8p0\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 779, in exec_module
  File "<frozen importlib._bootstrap_external>", line 916, in get_code
  File "<frozen importlib._bootstrap_external>", line 846, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "D:\pycharm_anzhuang\learning_log\learning_logs\models.py", line 5
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

4条回答 默认 最新

  • 已采纳
    QA_Assistant 有问必答小助手 2021-05-10 11:10

    您好,我是有问必答小助手,您的问题已经有小伙伴解答了,您看下是否解决,可以追评进行沟通哦~

    如果有您比较满意的答案 / 帮您提供解决思路的答案,可以点击【采纳】按钮,给回答的小伙伴一些鼓励哦~~

    ps:问答VIP仅需29元,即可享受5次/月 有问必答服务,了解详情>>>https://vip.csdn.net/askvip?utm_source=1146287632

    点赞 评论 复制链接分享
  • technologist_32 CSDN专家-Time 2021-05-09 08:46

    在代码头部 加 #coding=utf8

    点赞 评论 复制链接分享
  • hihell 梦想橡皮擦 2021-05-09 09:33

    不要 utf-8 的加载

    在setttigs.py里面用:

     

    LANGUAGE_CODE = 'en-us'
    点赞 评论 复制链接分享
  • QA_Assistant 有问必答小助手 2021-05-11 15:55

    非常感谢您使用有问必答服务,为了后续更快速的帮您解决问题,现诚邀您参与有问必答体验反馈。您的建议将会运用到我们的产品优化中,希望能得到您的支持与协助!

    速戳参与调研>>>https://t.csdnimg.cn/Kf0y

    点赞 评论 复制链接分享

相关推荐