[英]Debugging Crossbar.io app in IntelliJ
I'm building an app using Crossbar.io in IntelliJ. 我正在使用IntelliJ中的Crossbar.io构建应用程序。 Since you start the app using the
crossbar start
command in the shell I'm not clear on how to (ideally automatically) attach the Python debugger to the appropriate scripts. 由于您是在Shell中使用
crossbar start
命令启动应用程序的,因此我不清楚如何(理想情况下自动)将Python调试器附加到适当的脚本。 Anyone have any ideas? 有人有想法么?
Nice question. 好问题。
I was a little bit confused about how to debug as well because it seems like crossbar is sort of mixing up python 2 and 3 together. 我对如何调试也有些困惑,因为crossbar似乎将python 2和3混合在一起。 I wanted to install crossbar.io under a virtual environment with Python 3 because the examples components are using python 3 but for some reason I could not manage to install crossbar under a virtual environment with Python 3 and Im forced to use Python 2 for WAMP routing instead.
我想在使用Python 3的虚拟环境中安装crossbar.io,因为示例组件使用的是python 3,但是由于某些原因,我无法在使用Python 3的虚拟环境中安装crossbar,而我被迫使用Python 2进行WAMP路由代替。 I normally use pyenv rather than virtualenv, however, I believe they both are similar.
我通常使用pyenv而不是virtualenv,但是,我相信它们都是相似的。 I ended up creating 2 pyenvs.
我最终创建了2个pyenvs。 One with Python 2.7.6 purely for crossbario router and the other with Python 3.4.2 for App Components.
一个使用Python 2.7.6纯粹用于crossbario路由器,另一个使用Python 3.4.2适用于App Components。
Have a look at the Screenshot 看看截图
I don't know if it is the best way to solve this problem but this is what I did. 我不知道这是否是解决此问题的最佳方法,但这就是我所做的。 I used PyCharm but I believe IntelliJ is similar as well.
我使用了PyCharm,但我相信IntelliJ也是如此。
I haven't tried this under virtualenv but I reckon it is quite similar. 我没有在virtualenv下尝试过,但是我认为它非常相似。
Install python 2.7.6 via pyenv 通过pyenv安装python 2.7.6
\n$ pyenv install 2.7.6$ pyenv安装2.7.6\n
Create a pyenv with Python 2 for crossbar.io 使用Python 2为crossbar.io创建pyenv
\n$ pyenv virtualenv 2.7.6 crossbar$ pyenv virtualenv 2.7.6交叉开关\n$ pyenv activate crossbar
$ pyenv激活交叉开关\n(crossbar)$ pip install crossbar
(crossbar)$ pip安装crossbar\n
Find and copy the full path for crossbar executable you have just installed. 查找并复制刚安装的Crossbar可执行文件的完整路径。
\n(crossbar)$ which crossbar(crossbar)$其中\n
and copy the path. 并复制路径。
Install python 3.4.2 via pyenv 通过pyenv安装python 3.4.2
\n$ pyenv install 3.4.2$ pyenv安装3.4.2\n
Create a pyenv with Python 3 for app components 使用Python 3为应用程序组件创建pyenv
\n$ pyenv virtualenv 3.4.2 app$ pyenv virtualenv 3.4.2应用程序\n$ pyenv activate app
$ pyenv激活应用\n(app)$ pip install autobahn
(app)$点安装高速公路\n
Create a normal PyCharm project with "app" as a local python environment. 使用“ app”作为本地python环境创建一个普通的PyCharm项目。 I mean use python executable from app pyenv as an interpreter.
我的意思是使用来自应用pyenv的python可执行文件作为解释器。
Generate a hello world crossbar.io app. 生成一个hello world crossbar.io应用程序。
\n$ pyenv activate crossbar$ pyenv激活交叉开关\n(crossbar)$ crossbar init --template hello:python
(crossbar)$ crossbar初始化--template hello:python\n
From menubar go to Run/Edit configuration... 从菜单栏中转到运行/编辑配置...
\n~/.pyenv/versions/crossbar/bin/crossbar〜/ .pyenv /版本/交叉/斌/横梁\n
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.