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

查看:81
本文介绍了是否可以在本地托管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:

第1步: 从github下载nbviewer
第二步: 从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)

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

Step5: Edit gist.py
Comment out all these lines:

#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  

第6步: 运行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 username:password@svn/BizIntel/Trunk/notebook.ipynb

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

享受!

推荐答案

是的,nbviewer可以在本地安装,这通常是我们开发它的方式. 如果您想在您自己的计算机上使用自动重启功能,在Heroku上进行设置,则Yon可以使用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天全站免登陆