使用Rpy2将Django部署到Heroku

时间:2013-03-19 22:12:22

标签: python django r heroku

我是一个新手,在使用django和rpy2在Heroku上工作时,能够获得一些小的能力。特别是,我试图测试rpy2创建的并发漏洞,看看Heroku是否可以防范它(通过dyno隔离?)。

部署django样本很好,但添加rpy2会导致R依赖性不足

git push heroku master
Counting objects: 11, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (9/9), done.
Writing objects: 100% (11/11), 3.97 KiB, done.
Total 11 (delta 0), reused 0 (delta 0)

-----> Python app detected
-----> No runtime.txt provided; assuming python-2.7.3.
-----> Preparing Python runtime (python-2.7.3)
-----> Installing Distribute (0.6.34)
-----> Installing Pip (1.2.1)
-----> Installing dependencies using Pip (1.2.1)
       Downloading/unpacking Django==1.5 (from -r requirements.txt (line 1))
         Running setup.py egg_info for package Django

       Downloading/unpacking argparse==1.2.1 (from -r requirements.txt (line 2))
         Running setup.py egg_info for package argparse

           no previously-included directories found matching 'doc/_build'
           no previously-included directories found matching 'env24'
           no previously-included directories found matching 'env25'
           no previously-included directories found matching 'env26'
           no previously-included directories found matching 'env27'
       Downloading/unpacking rpy2==2.3.4 (from -r requirements.txt (line 3))
         Running setup.py egg_info for package rpy2

           sh: R: not found
           Error: Tried to guess R's HOME but no R command in the PATH.
           Complete output from command python setup.py egg_info:
           running egg_info

       creating pip-egg-info/rpy2.egg-info

       writing pip-egg-info/rpy2.egg-info/PKG-INFO

       writing top-level names to pip-egg-info/rpy2.egg-info/top_level.txt

       writing dependency_links to pip-egg-info/rpy2.egg-info/dependency_links.txt

       writing manifest file 'pip-egg-info/rpy2.egg-info/SOURCES.txt'

       warning: manifest_maker: standard file '-c' not found



       sh: R: not found

       Error: Tried to guess R's HOME but no R command in the PATH.

       ----------------------------------------
       Command python setup.py egg_info failed with error code 1 in /app/build/rpy2
       Storing complete log in /app/.pip/pip.log
 !     Heroku push rejected, failed to compile Python app

To git@heroku.com:infinite-plateau-7086.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:infinite-plateau-7086.git'

添加init.r会导致Heroku识别R应用程序并获得R up

    $ git push heroku master
Counting objects: 13, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (11/11), done.
Writing objects: 100% (13/13), 4.15 KiB, done.
Total 13 (delta 1), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
-----> R app detected
       Vendoring R 2.15.1
       Downloading and unpacking R binaries
       Executing init.r script
       R 2.15.1 successfully installed
-----> Discovering process types

-----> Compiled slug size: 96.7MB
-----> Launching... done, v5
       http://infinite-plateau-7086.herokuapp.com deployed to Heroku

To git@heroku.com:infinite-plateau-7086.git
 * [new branch]      master -> master

但无论有没有init.r文件,应用程序识别都不会看到带有R up的django

$ git push heroku master
Counting objects: 5, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 289 bytes, done.
Total 3 (delta 2), reused 0 (delta 0)

-----> Fetching custom git buildpack... done
 !     Heroku push rejected, no Cedar-supported app detected

To git@heroku.com:infinite-plateau-7086.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:infinite-plateau-7086.git'

我正在使用r buildpackmulti buildpack来允许r django互动。任何人都知道如何解决上述依赖冲突(因为我想最终将两者结合使用),或者R和python交互是否无法在Heroku上安全扩展?

0 个答案:

没有答案