Django - webbrowser.open doesn`t work in production mode

I am developing an app that should send msg by WhatsApp. Running from Django Development Server works fine, but from Xampp it doesn't, I even tried opening whatsapp from the url directly in the project and it doesn't work either. The problem is open function from webbrowser module.

Python 3.10.6

Django 3.2.0

def send_whatsapp(telefono, mensaje):
    try:
        webbrowser.open_new_tab(f"https://web.whatsapp.com/send?phone={telefono}&text={mensaje}")
        print("Mensaje enviado")
    except Exception:
        print("Error")

Thanks!!

Back to Top