[英]Include python console in Django application to interact with dataset
How can I include a Python terminal / console in a Django application that users can execute python code against? 我如何在Django应用程序中包含一个Python终端/控制台,用户可以对其执行python代码? For example, df.column_b * df.column_a
if the example data is: 例如,如果示例数据为: df.column_b * df.column_a
:
column_a, column_b
1, 2
2, 4
3, 8
My use case is that it is easy for me to get data into my Django application. 我的用例是,我很容易将数据获取到Django应用程序中。 However, a common use case is for users to copy and paste the data into a spreadsheet and start doing some work / computation with the data. 但是,一个常见的用例是用户将数据复制并粘贴到电子表格中,然后开始对数据进行一些工作/计算。 It would be nice if they didn't have to leave the page and could just do the computations directly in Python. 如果他们不必离开页面就可以直接在Python中进行计算,那将是很好的。
An example website is LearnPython.org . 一个示例网站是LearnPython.org 。 After inspecting the website a little bit, it looks like it uses CodeMirror.js . 在稍微检查一下网站之后,看起来它使用了CodeMirror.js 。 I have taken a look at the CodeMirror docs and the div
for LearnPython.org's Run
button, but it is not clear to me how I'd take the leap from registering an onClick
event to: 我看过CodeMirror文档和LearnPython.org的Run
按钮的div
,但是我不清楚我如何从注册onClick
事件跃升为:
Or could I do this all client side? 还是我可以在所有客户端这样做?
Any pointers in the right direction is greatly appreciated. 任何朝着正确方向的指针都将不胜感激。
Have you seen this project ? 你看过这个项目吗?
What is DataCamp Light, and how can I use it? 什么是DataCamp Light,如何使用?
In addition to an extensive course library, DataCamp also offers 'Open Courses' that any DataCamp user can create and take. 除了丰富的课程库之外,DataCamp还提供任何DataCamp用户都可以创建和参加的“开放课程”。 If you already have MOOC (Massive Open Online course) content you would like to publish using the DataCamp learning environment, you can get started here: https://www.datacamp.com/teach and see some examples here: https://www.datacamp.com/community/open-courses . 如果你已经有了MOOC(大规模开放在线课堂)的内容,你想使用DataCamp学习环境进行发布,你可以在这里开始: https://www.datacamp.com/teach ,看到这里的一些例子: https://开头www.datacamp.com/community/open-courses 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.