Debugging JavaScript with Flask and PyCharm

I just installed the professional version of PyCharm for my Flask functions, but I am having a lot of problems with JavaScript related work.

First, is there a way to open the browser when starting the flask project? ... There seems to be no Flask launch configuration, which means you have to use Python's default configuration, and it doesn't have the ability to launch the browser. I tried to create a JavaScript Debug project that starts the server as a "Before Start" command, but it still won't open the browser (Chrome or Firefox).

Second, how can I get PyCharm to hit JavaScript breakpoints? Even if I manually go to the flags server ( http://localhost:5555/

), Intellij won't hit breakpoints in my JavaScript, even though the JetBrains plugin is installed (again, in both Firefox and Chrome). I suspect this might be due to PyCharm not opening the browser, so I mentioned this as my first point.

Can anyone with experience in PyCharm or IntelliJ help me?


source to share

1 answer

Just solved this problem.

You need setup steps.

My prerequisites:

PyCharm on my local laptop

I am developing in a remote virtual machine (DO blob, Ubuntu)

  • Setting up a web server. It should be Apache, nginx.
  • Setting up a web application. The web application must be running on a web server.
  • Debug configuration setting:

and. Run-> Edit Configuration

b. Add-> JavaScript debug

from. Specify the url as the real url of the web browser, for example: http: // YOUR_IP: YOUR_PORT / directory / category

Specify the HTML template file / directory and the remote url where your template is located.

e. Debug it.

f. Profit!:)

PS So lovely JavaScript variable evaluation from familiar PyCharm tool :)

P.S2: almost forgot: need to install Chrome extension:



All Articles