Django를 사용하면서 발생한 이상한 오류 해결기...
root@django:/home/test# python3 manage.py createsuperuser Traceback (most recent call last): File "manage.py", line 15, inexecute_from_command_line(sys.argv) File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/usr/local/lib/python3.6/dist-packages/django/core/management/__init__.py", line 375, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 316, in run_from_argv self.execute(*args, **cmd_options) File "/usr/local/lib/python3.6/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 59, in execute return super().execute(*args, **options) File "/usr/local/lib/python3.6/dist-packages/django/core/management/base.py", line 353, in execute output = self.handle(*args, **options) File "/usr/local/lib/python3.6/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 112, in handle username = self.get_input_data(self.username_field, input_msg, default_username) File "/usr/local/lib/python3.6/dist-packages/django/contrib/auth/management/commands/createsuperuser.py", line 193, in get_input_data raw_value = input(message) UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-2: ordinal not in range(128)
해결 방안
export PYTHONIOENCODING="UTF-8";
ubuntu 버전에 따라 동작안할 수 도 있으나 대부분 동작함.