UnicodeEncodeError: 'utf-8' codec can't encode characters in position 50-51: surrogates not allowed
python manage.py collectstatic 收集報錯:
Traceback (most recent call last):
File "manage.py", line 23, in <module>
execute_from_command_line(sys.argv)
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
self.execute(*args, **cmd_options)
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
output = self.handle(*args, **options)
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 199, in handle
collected = self.collect()
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 124, in collect
handler(path, prefixed_path, storage)
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 362, in copy_file
self.log("Copying '%s'" % source_path, level=1)
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/contrib/staticfiles/management/commands/collectstatic.py", line 224, in log
self.stdout.write(msg)
File "/root/.virtualenvs/kfsd/lib/python3.6/site-packages/django/core/management/base.py", line 110, in write
self._out.write(force_str(style_func(msg)))
UnicodeEncodeError: 'utf-8' codec can't encode characters in position 50-51: surrogates not allowed
原因修改xshell 上傳時的字元編碼
使用utf-8編碼