Closed ITJamie closed 7 months ago
Can you provide an example where you also show the env vars you have set (which should match the documentation example as well)?
The RUN_MAIN
env var is what Django uses to determine which thread you're in when the autoreloader is using. It's possible the latest version of Django somehow changes this functionality and we need to distinguish which thread we're in in some other way now? But I'd need to see more about your code / env in comparison to the docs to troubleshoot before I dig in to this further.
Just used django-admin
in 4.x to init a new Django project, followed the integration example in the pyngrok
docs, all still works fine. pyngrok
is only initialized in the main thread on the dev server, so only one tunnel is opened, which means it will work with a free account. Closing this until more information is provided for how to reproduce the error.
Describe the Bug when attempting to use the django example from the docs on a free ngrok account (one active tunnel limited) the django app will fail to run and complain about there already being an ngrok tunnel in use
Steps to Reproduce create an empty django project with the example added from docs use an authtoken on a basic free ngrok account run python3 manage.py runserver
Expected Behavior ngrok tunnel to start, django runserver to start correctly
Environment
pyngrok
Version: 7.0.1Additional Context
i believe this to be related to what was mentioned in: https://github.com/alexdlaird/pyngrok/issues/52
django's manage.py runserver starts two threads. the master file watcher thread and the actual app-running thread. the example code should be adjusted to only run in one of these