Debugging Crossbar.io App In Intellij
Solution 1:
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. 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. I normally use pyenv rather than virtualenv, however, I believe they both are similar. I ended up creating 2 pyenvs. One with Python 2.7.6 purely for crossbario router and the other with Python 3.4.2 for App Components.
My Solution
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.
I haven't tried this under virtualenv but I reckon it is quite similar.
Install python 2.7.6 via pyenv
$ pyenv install 2.7.6
Create a pyenv with Python 2 for crossbar.io
$ pyenv virtualenv 2.7.6 crossbar $ pyenv activate crossbar (crossbar)$ pip install crossbar
Find and copy the full path for crossbar executable you have just installed.
(crossbar)$ which crossbar
and copy the path.
Install python 3.4.2 via pyenv
$ pyenv install 3.4.2
Create a pyenv with Python 3 for app components
$ pyenv virtualenv 3.4.2 app $ pyenv activate app (app)$ pip install autobahn
Create a normal PyCharm project with "app" as a local python environment. I mean use python executable from app pyenv as an interpreter.
Generate a hello world crossbar.io app.
$ pyenv activate crossbar (crossbar)$ crossbar init --template hello:python
From menubar go to Run/Edit configuration...
- Click a green + icon and select Python
- Paste the full path for crossbar executable script.
~/.pyenv/versions/crossbar/bin/crossbar
- put the word start as Script parameters.
- Make sure to select crossbar as a Python interpreter not app. Please correct me if Im wrong but I believe the interpreter we select here is only for running and debugging purpose not for code completion and stuffs.
- Make sure to put the path where .crossbar folder is located as a Working directory path.
- Visit 0.0.0.0:8080 to trigger the debug session.
Post a Comment for "Debugging Crossbar.io App In Intellij"