Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use serverReadyAction in django/flask to start the web browser #5192

Closed
karthiknadig opened this issue Apr 10, 2019 · 1 comment
Closed

Use serverReadyAction in django/flask to start the web browser #5192

karthiknadig opened this issue Apr 10, 2019 · 1 comment

Comments

@karthiknadig
Copy link
Member

This is a pattern that works for Django/Flask:

            "serverReadyAction": {
                "pattern": ".*(https?:\\/\\/\\S+:[0-9]+\\/?).*",
                "uriFormat": "%s",
                "action": "openExternally"
              }

There is a issue when using subProcess: true. This results in multiple tabs being opened. This is because for every debug adapter it launches a separate tab. we either need to block that, or remove serverReadyAction when we attach to the sub-process.

Full Dajngo config:

        {
            "name": "Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}/manage.py",
            "args": [
                "runserver",
                "--noreload",
                "--nothreading"
            ],
            "django": true,
            "serverReadyAction": {
                "pattern": ".*(https?:\\/\\/\\S+:[0-9]+\\/?).*",
                "uriFormat": "%s",
                "action": "openExternally"
              }
        }

Full Flask Config:

        {
            "name": "Flask",
            "type": "python",
            "request": "launch",
            "module": "flask",
            "env": {
                "FLASK_APP": "app.py",
                "FLASK_ENV": "development",
                "FLASK_DEBUG": "0"
            },
            "args": [
                "run",
                "--no-debugger",
                "--no-reload"
            ],
            "jinja": true,
            "serverReadyAction": {
                "pattern": ".*(https?:\\/\\/\\S+:[0-9]+\\/?).*",
                "uriFormat": "%s",
                "action": "openExternally"
              }
        }
@ghost ghost added the triage-needed Needs assignment to the proper sub-team label Apr 10, 2019
@DonJayamanne
Copy link

Duplicate of #1058

@DonJayamanne DonJayamanne marked this as a duplicate of #1058 Apr 11, 2019
@ghost ghost removed the triage-needed Needs assignment to the proper sub-team label Apr 11, 2019
@lock lock bot locked as resolved and limited conversation to collaborators May 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants