小编Vac*_*zal的帖子

Ansible Django模块替代Python解释器

我正在编写一个用于部署django应用程序的ansible playbook.作为该过程的一部分,我想运行该staticcollect命令.

我遇到的问题是远程服务器有两个python解释器,一个是Python2.6,一个是Python2.7,Python2.6是默认的.

当我运行playbook时,它使用Python2.6解释器运行,我需要它来运行Python2.7解释器.

有关如何实现这一点的任何想法?

我的剧本如下:

- hosts: xxxxxxxxx
  vars:
    hg_branch:  dmv2
    django_dir: /opt/app/xxxx
    conf_file:  /opt/app/conf/xx_uwsgi.ini
    django_env:
        STATIC_ROOT: /opt/app/serve/static
  remote_user: xxxxxx
  tasks:
  - name: Update the hg repo
    command: chdir=/opt/app/xxxxx  hg pull -u --rev {{hg_branch}}
  - name: Collect static resources
    environment: django_env
    django_manage: command=collectstatic app_path={{django_dir}}
  - name: Restart the django service
    command: touch {{conf_file}}
  - name: check nginx is running
    service: name=nginx state=started
Run Code Online (Sandbox Code Playgroud)

python django ansible

5
推荐指数
1
解决办法
392
查看次数

标签 统计

ansible ×1

django ×1

python ×1