图Python 3兼容?

时间:2014-11-26 12:49:09

标签: python django docker fig

我有一个运行python 3.4的django应用程序,我想使用Fig帮助为我的应用程序的组件设置dockerized容器。 当我运行fig up时,我收到以下错误:

Recreating app_db_1...
Recreating app_search_1...
Creating app_web_1...
Traceback (most recent call last):
  File "/usr/local/Cellar/fig/1.0.1/libexec/bin/fig", line 9, in <module>
    load_entry_point('fig==1.0.1', 'console_scripts', 'fig')()
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/cli/main.py", line 31, in main
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/cli/docopt_command.py", line 21, in sys_dispatch
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/cli/command.py", line 28, in dispatch
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/cli/docopt_command.py", line 24, in dispatch
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/cli/command.py", line 56, in perform_command
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/cli/main.py", line 427, in up
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/project.py", line 174, in up
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/service.py", line 199, in recreate_containers
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/service.py", line 176, in create_container
  File "/usr/local/Cellar/fig/1.0.1/lib/python2.7/site-packages/fig-1.0.1-py2.7.egg/fig/service.py", line 370, in _get_container_create_options
TypeError: unhashable type: 'dict'

这是因为与Python 3不兼容吗?即我有什么方法可以使用无花果来帮助构建我的应用程序,或者我运气不好?图是使用自制软件安装的。

这是我的图文件:

db:
    image: kartoza/postgis
web:
    build: .
    command: python manage.py runserver:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    links:
      - db
      - search
    environment:
      - ALLOWED_HOSTS:
      - STRIPE_CLIENT_ID:
      - STRIPE_CLIENT_SECRET:
      - GOOGLE_API_KEY:
search:
    image: dockerfile/elasticsearch
    links:
      - db

2 个答案:

答案 0 :(得分:6)

原来问题不在于Python的版本,而在于我的图形文件。

图文件不应该在环境变量前面有破折号。更正的图文件如下:

db:
    image: kartoza/postgis
web:
    build: .
    command: python manage.py runserver:8000
    volumes:
      - .:/code
    ports:
      - "8000:8000"
    links:
      - db
      - search
    environment:
      ALLOWED_HOSTS:
      STRIPE_CLIENT_ID:
      STRIPE_CLIENT_SECRET:
      GOOGLE_API_KEY:
search:
    image: dockerfile/elasticsearch
    links:
      - db

Fig是一个用Python 2.7编写的工具,并没有在Python 3中提供,但这并不意味着它与Python 3项目不兼容,因为它没有集成到项目代码中。它是一个单独的工具,由python 2.7自行运行。

答案 1 :(得分:0)

包名称包含提示:fig-1.0.1-py2.7.egg

好像你安装了图2的Python 2版本。尝试使用Python 3环境中的pip install fig进行安装。