是否可以在本地托管 nbviewer? [英] Is it possible to host nbviewer locally?

查看:17
本文介绍了是否可以在本地托管 nbviewer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将 nbviewer 带到我的工作中.因为我不能共享公司数据(放在github上),我需要在本地安装nbviewer.有在 Heroku 上设置的说明,但这对我不起作用.有没有人尝试过这个?甚至值得付出努力吗?还有其他选择吗?谢谢.

I want to bring nbviewer to my job. Because I am not able to share company data (place it on github), I will need to install nbviewer locally. There are instructions to set one up on Heroku but this will not work for me. Has anyone attempted this? Is it even worth the effort? Any other alternatives? Thanks.

在本地机器上运行 nbviewer 的步骤:

Steps to get nbviewer running on your local machine:

第一步:从github下载nbviewer
第2步:从github下载nbconvert
第3步:将nbconvert内容放入nbviewer内的nbconvert"文件夹

Step1: Download nbviewer from github
Step2: Download nbconvert from github
Step3: Place nbconvert contents into the "nbconvert" folder inside nbviewer

第 4 步:获取所需的库
easy_install Flask==0.9
easy_install Flask-Markdown
easy_install 请求
easy_install Pygments(带有python xy)
easy_install Markdown==2.2.0
easy_install pylibmc==1.2.3
easy_install 龙卷风
easy_install newrelic(未能安装可选的 c 扩展,但认为这没问题)
easy_install pyzmq(自带python xy)

Step4: Get required libraries
easy_install Flask==0.9
easy_install Flask-Markdown
easy_install requests
easy_install Pygments (comes with python xy)
easy_install Markdown==2.2.0
easy_install pylibmc==1.2.3
easy_install tornado
easy_install newrelic (failed to install optional c extension but think this is ok)
easy_install pyzmq (comes with python xy)

第五步:编辑 gist.py
注释掉所有这些行:

#from flask.ext.cache import Cache line 17   
#from lib.MemcachedMultipart import multipartmemecached line 20  
#cache = Cache(app, config=config) line 63  
#@cache.cached(5*hours) line 92  
#@cache.cached(5*hours) line 107  
#@cache.cached(5*hours) line 112  
#@cache.cached(5*hours) line 117  
#@cache.cached(5*hours) line 122  
#@cache.cached(5*hours) line 127  
#@cache.cached(1*minutes) line 133  
#@cache.memoize() line 177  
#@cache.memoize(10*minutes) line 201  

第六步:运行 app.py
Step7: 到 localhost:5000

Step6: Run app.py
Step7: got to localhost:5000

如何处理身份验证问题?(笔记本位于受密码保护的存储库中)
错误:请求失败:GET http svn/BizIntel/Trunk/notebook.ipynb:401 需要授权

How does one deal with authentication issues? (notebooks are in a repo that is password protected)
ERROR: Failed request: GET http svn/BizIntel/Trunk/notebook.ipynb: 401 Authorization Required

答案:http 用户名:password@svn/BizIntel/Trunk/notebook.ipynb

Answer: http username:password@svn/BizIntel/Trunk/notebook.ipynb

享受吧!

推荐答案

是的,nbviewer 可以在本地安装,这通常是我们开发它的方式.如果你想在你自己的机器上使用自动重启,你可以使用 heroku foreman 的设置.

Yes, nbviewer can be installed locally, that usually how we develop it. Yon can use heroku foreman if you want a setup close to heroku one with autorestart on your own machine.

如果你想要一些简单的东西,只需克隆 nbviewer,在 requirements.txt 中安装依赖项并运行 python app.py(可能是 git update 的子模块).可能有一些环境变量需要设置,如 memcached,但如果需要,您应该可以禁用它.

If you want something easy, just clone nbviewer, install the dependencies in requirements.txt and run python app.py (maybe a submodule to git update. There might be a few environement variable to set like memcached, but you should be able to disable it if needed.

然后您可以打开浏览器访问 localhost:5000,您应该在本地运行自己的 nbviewer 版本.

You can then open you browser to localhost:5000 and you should have your own version of nbviewer running locally.

它不会消除通过本地 url 访问 ipynb 文件以使其工作的必要性,但如果它安装在公司防火墙后面,那应该不是问题.

It will not remove the necessity to have the ipynb file accessible through a local url for it to work, but if it's installed behind company firewall, that shouldn't be a problem.

如有需要,请随时在 github 上打开问题.

Feel free to open issues on github if needed.

这篇关于是否可以在本地托管 nbviewer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆