问题标签 [justpy]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
196 浏览

nginx - How to configure uvicorn in nginx for justpy

I have an extremely simple flask app that works perfectly with gunicorn and nginx over https with a domain. This shows me that all other configurations are working (IP, ports, https, etc.), but when I try and use it with the justpy library, which uses uvicorn, there is no interaction. The strange thing is that when I run it over the public ip of the GCP with the open port, it works just fine, so I am assuming it is a problem with my configuration of nginx.

The configuration and examples are below, along with the documentation I could find on this. This is running on a GCP VM instance, (e2 micro) with Ubuntu 21.04 installed. The public IP has been made static and I am using letsencrypt for HTTPS with the domain.

This might just be because the justpy library is so new, but I wanted to make sure it was not because of configuring nginx incorrectly.

So, using the simple flask app:

We get what we wanted when we go to https://test1.domain.com (test1.domain.com being just an example) which is "Hello World from flaskapp 1!" using the command

gunicorn fl1:app -b 0.0.0.0:5000

and using the following nginx config:

As well, if we use the code for justpy (which comes directly from their documentation here, and here) this also gives us what we want without any errors if I run it over the public IP with the open port and using a slight modification to the gunicorn command above:

This will give us a box that turns red with "Mouse entered" when the mouse is inside the box, green with "Mouse left" when the mouse is not in the box, and blue with "I was clicked" when we click on the box.

All that works, but, when I start using nginx (with the config above) to use https and the domain, that is when it starts to fail and the app constantly says "Page needs to be reloaded, click OK to reload" and it just keeps on reloading each time you click on OK. I suppose it has to do with the nginx config with uvicorn, but I have yet to figure it out.

The uvicorn documentation does not help much, and justpy has something in its main.html file for websockets from line 65, but I don't know how that would affect nginx. Any help would be appreciated.

0 投票
0 回答
169 浏览

python - AttributeError:'dict' 对象没有属性'has_key' Highcharts 错误

我现在收到这个错误好几天了。出于 setuptools - demsjon - justpy 兼容性的原因,尝试从 Python3.9.9 降级到 Python3.9.2。我正在尝试将 JavaScript 转换为 Python 字典。这是我想在 Quasar 页面上制作的样条图。

这是代码:

我收到一条 huuuuge 回溯消息:

更新:

我设法克服了这个错误,并且使用 demjson==2.2.4 得到了一个新错误:

0 投票
2 回答
83 浏览

python - 来自 highcharts 的饼图不通过 justpy 呈现

我正在尝试在 justpy中使用来自www.highcharts.com的饼图。

页面加载但图表未呈现。

我使用了这个来源的代码: https ://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/demo/pie-basic

我简化了代码以缩小问题范围:

我试图在不同的浏览器中打开它。我试图重新启动服务器,ide。来自 highcharts.com 的大多数图表都在工作(样条、区域样条、流图)。但是,我在折线图上遇到了同样的问题:https ://www.highcharts.com/docs/chart-and-series-types/line-chart 。

更新。为样条图添加工作示例:

0 投票
0 回答
23 浏览

justpy - justPy 切换 Quasar 抽屉

我从 Quasar 复制了一些 HTML 用于带有抽屉的页面布局,但无法弄清楚如何切换抽屉(侧边栏)。该按钮用于隐藏抽屉,但无法再次显示。或者,如果您有一个示例或可以向我指出以类似方式工作的非 Quasar 侧边栏的方向,那将很有帮助。

0 投票
0 回答
18 浏览

python - 如何在justpy中处理null

我正在尝试在 highcharts 中绘制多个多边形,可以通过在 highcharts 中插入 null 分隔多边形来实现。

使用justpy在python中实现的等效方法是什么?目前我必须分别创建两个多边形:

我曾尝试将它们结合起来并使用 None 来分开,但它没有用。

0 投票
0 回答
15 浏览

python - 使用过滤器事件时,Justpy QSelect 不会在下拉列表中显示值

我一直在尝试在 Justpy 中创建一个过滤下拉菜单。我一直在使用 QSelect 组件来执行此操作。这里的第二个下拉菜单是我想要构建的。

我可以让下拉菜单使用输入事件来填充和显示我想要的值。我可以通过这种方式手动选择我想要的值。我的问题是当我使用过滤器事件时,下拉列表不再填充。相反,我得到一个旋转的“加载”图标。

这是我的代码:

我试过在我的事件处理程序中调用 Quasar 方法,例如:wp.dropdown.run_method(f'filter({msg.value})', msg.websocket),但这并没有改变任何东西。我已经尝试过使用不同的事件,填充不同的道具等,但我无法更接近。

也许我需要为 QSelect 组件添加一个模型,但我真的不知道那会是什么样子。

我想我错过了一些非常简单的东西。我对 JavaScript 没有任何经验,因此找到解决方案非常困难。非常感谢任何能让我更接近解决方案的提示或指导。谢谢你。