Django无法在Heroku上迁移数据库

时间:2015-03-14 12:16:20

标签: django heroku

我尝试在Heroku上部署应用程序,但在运行命令'heroku run python manage.py migrate'后出现错误:

 Running `python manage.py migrate` attached to terminal... up, run.5928
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
    utility.execute()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute
    output = self.handle(*args, **options)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 63, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/migrations/executor.py", line 17, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/migrations/loader.py", line 48, in __init__
    self.build_graph()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/migrations/loader.py", line 173, in build_graph
    self.load_disk()
  File "/app/.heroku/python/lib/python2.7/site-packages/django/db/migrations/loader.py", line 103, in load_disk
    migration_module = import_module("%s.%s" % (module_name, migration_name))
  File "/app/.heroku/python/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/app/joins/migrations/0004_auto_20150211_1924.py", line 7, in <module>
    class Migration(migrations.Migration):
  File "/app/joins/migrations/0004_auto_20150211_1924.py", line 18, in Migration
    preserve_default=True,
TypeError: __init__() got an unexpected keyword argument 'preserve_default'

你有什么建议吗?

1 个答案:

答案 0 :(得分:0)

您可以尝试看到这个:

  

Django 1.7.1在AlterField中添加了对preserve_default参数的支持。因此,从1.7版升级Django将解决该问题。   pip install django --upgrade   python manage.py migrate

     

来自:Django 1.7 Migrations