Ejecutar el servidor Flask

Antes de que pueda iniciar su servidor, tendrá que proporcionar la configuración en un archivo .env archivo. Comience por lo siguiente y rellene sus datos:

# Do not use this in production:
FLASK_DEBUG=true
 
# Replace the following with any random value you like:
FLASK_SECRET_KEY=RANDOM-STRING_CHANGE-THIS-Ea359
 
# Get from ${CUSTOMER_DASHBOARD_URL}/your-numbers
NEXMO_NUMBER=447700900025
 
# Get the following from ${CUSTOMER_DASHBOARD_URL}/settings
NEXMO_API_KEY=abcd1234
NEXMO_API_SECRET=abcdef12345678

Ahora inicia tu aplicación con:

# You may need to change the path below if your Flask app is in a different Python file:
$ FLASK_APP=smsweb/server.py flask run
* Serving Flask app "smsweb.server"
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Ahora bien, si carga http://localhost:5000/deberías ver algo como esto:

SMS Flask application window, showing fields for phone number and message

Cómo enviar mensajes SMS con Python, Flask y Nexmo

Este tutorial te introduce al envío de SMS con Python, haciendo uso de la librería Nexmo Python. Comienza mostrando cómo enviar SMS desde el REPL, luego pasa a mostrar cómo construir una aplicación simple de flask con capacidades de SMS.

Pasos
1
Introducción a este tutorial
2
Prerequisites
3
Instala el SDK de servidor Python de Vonage
4
Enviar un SMS desde Python REPL
5
Configurar una aplicación Flask de envío de SMS
6
Añadir una vista Enviar SMS
7
Ejecutar el servidor Flask
8
Gestionar la entrada del formulario
9
¿Y ahora qué?