转储的heroku数据库在本地计算机上给出了“ UnicodeDecodeError”异常

时间:2018-06-29 20:56:23

标签: python django postgresql heroku heroku-postgres

我正在尝试将heroku项目(django)及其数据库下载到另一台本地计算机。 我已经设法通过pg:backups下载了git和数据库项目。我已经将数据库从备份还原到本地postgres,现在可以在pgAdmin中成功看到它了。但是,当我尝试运行项目或迁移项目时,出现“ UnicodeDecodeError”异常。问题的根源是什么?我在Windows7上将conda与python2.7一起使用。

[worldcup2018env] G:\Programming\world-champ-2018>python manage.py migrate

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\core\management\__init__.py", line 364, in execute_from_command_
line
    utility.execute()
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\core\management\__init__.py", line 356, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\core\management\base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\core\management\base.py", line 330, in execute
    output = self.handle(*args, **options)
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\core\management\commands\migrate.py", line 83, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\db\migrations\executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\db\migrations\loader.py", line 52, in __init__
    self.build_graph()
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\db\migrations\loader.py", line 209, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\db\migrations\recorder.py", line 69, in applied_migrations
    self.ensure_schema()
  File "C:\Anaconda\envs\worldcup2018env\lib\site-packages\django\db\migrations\recorder.py", line 63, in ensure_schema
    raise MigrationSchemaMissing("Unable to create the django_migrations table (%s)" % exc)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd0 in position 0: ordinal not in range(128)

我的环境:

(worldcup2018env) conda list
# packages in environment at C:\Anaconda\envs\worldcup2018env:
#
# Name                    Version                   Build  Channel
certifi                   2016.2.28                py27_0
certifi                   2018.4.16                 <pip>
chardet                   3.0.4                     <pip>
Django                    1.11.12                   <pip>
django-allauth            0.35.0                    <pip>
idna                      2.6                       <pip>
oauthlib                  2.0.7                     <pip>
Pillow                    5.1.0                     <pip>
pip                       9.0.1                    py27_1
pip                       10.0.1                    <pip>
psycopg2                  2.7.4                     <pip>
python                    2.7.13                        1
python-openid             2.2.5                     <pip>
pytz                      2018.4                    <pip>
requests                  2.18.4                    <pip>
requests-oauthlib         0.8.0                     <pip>
setuptools                36.4.0                   py27_1
urllib3                   1.22                      <pip>
vc                        9                             0
vs2008_runtime            9.00.30729.5054               0
wheel                     0.29.0                   py27_0
wincertstore              0.2                      py27_0

0 个答案:

没有答案