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

Visual Studio Code debugging implementation in manage.py causes error #101

Open
Schwankenson opened this issue Mar 26, 2020 · 0 comments
Open

Comments

@Schwankenson
Copy link

I configured django single step debugging for Visual Studio Code with this tutorial:

https://gist.github.com/veuncent/1e7fcfe891883dfc52516443a008cfcb

The code

from django.conf import settings

if settings.DEBUG:
    if os.environ.get('RUN_MAIN') or os.environ.get('WERKZEUG_RUN_MAIN'):
        import ptvsd
        ptvsd.enable_attach(address = ('0.0.0.0', 8005))
        print("Attached remote debugger")

Caused an error in my application, because the django.conf.settings object was not available in one of my subapps.

I changed the code to

if os.environ.get('RG_START_PTVSD_DEBUGGER'):
    if os.environ.get('RUN_MAIN') or os.environ.get('WERKZEUG_RUN_MAIN'):
        import ptvsd
        ptvsd.enable_attach(address = ('0.0.0.0', 8005))
        print("Attached remote debugger")

And everything worked fine.

The error was only in the sslserver, not in django runserver itself

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant