{"id":7117,"date":"2019-06-26T03:11:26","date_gmt":"2019-06-26T10:11:26","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=7117"},"modified":"2025-06-13T21:10:53","modified_gmt":"2025-06-14T04:10:53","slug":"diary-web-application","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/diary-web-application\/","title":{"rendered":"Crear una aplicaci\u00f3n web de agenda con Couchbase como back-end"},"content":{"rendered":"<p><b>Michael Aboagye es un ingeniero de software\/seguridad backend residente en Ghana. <\/b><b>Est\u00e1 interesado en la creaci\u00f3n de servicios backend seguros con Python.<\/b><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3152\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/04\/MIKE-IMAGE.jpg\" alt=\"Michael K. Aboagye\" width=\"199\" height=\"199\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE.jpg 199w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-150x150.jpg 150w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-65x65.jpg 65w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-50x50.jpg 50w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/04\/MIKE-IMAGE-20x20.jpg 20w\" sizes=\"auto, (max-width: 199px) 100vw, 199px\" \/><\/p>\n<p><span style=\"font-weight: 400\">En este tutorial, veremos c\u00f3mo podemos construir una aplicaci\u00f3n web de diario basada en el framework flask con Couchbase como servidor backend. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Al final de este tutorial, ser\u00e1s capaz de construir una aplicaci\u00f3n web sencilla con el framework Flask para enviar los datos de los usuarios a un servidor Couchbase. Adem\u00e1s, aprender\u00e1s a configurar un servidor Couchbase.<\/span><\/p>\n<p><b>Requisitos previos<\/b><\/p>\n<p><span style=\"font-weight: 400\">Necesitas los siguientes paquetes para ejecutar o clonar el proyecto desde GitHub.<\/span><\/p>\n<ul>\n<li><b><a href=\"https:\/\/github.com\/pallets\/flask\">Marco Flask<\/a> (\u00faltima versi\u00f3n)<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Flask framework es un micro framework escrito en Python. Es un micro framework porque no viene con un formulario de validaci\u00f3n, mecanismo de autenticaci\u00f3n, y as\u00ed sucesivamente. Te permite personalizar las aplicaciones a tu manera.<\/span><\/p>\n<ul>\n<li><b><a href=\"https:\/\/jinja.pocoo.org\/\">Plantilla Jinja<\/a> (\u00faltima versi\u00f3n)<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Una plantilla Jinja es simplemente un archivo de texto que contiene variables y expresiones, las cuales son reemplazadas cuando una plantilla es renderizada o mostrada.<\/span><\/p>\n<ul>\n<li><b><a href=\"https:\/\/www.couchbase.com\/blog\/es\/downloads\/\">Servidor Couchbase<\/a> (edici\u00f3n comunitaria) <\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Couchbase Server es una base de datos de documentos NoSQL escalable. Utilizaremos el servidor Couchbase para almacenar los datos de los usuarios. <\/span><\/p>\n<h2><b>Crear un entorno virtual<\/b><\/h2>\n<p><span style=\"font-weight: 400\">En primer lugar, cree un directorio para alojar el entorno virtual utilizando <\/span><span style=\"font-weight: 400\">mkdir<\/span><span style=\"font-weight: 400\"> mando.<\/span><\/p>\n<p><span style=\"font-weight: 400\">El siguiente comando crea un directorio como<\/span> <span style=\"font-weight: 400\">proyecto web<\/span> <span style=\"font-weight: 400\">y lo cambia por el <\/span><span style=\"font-weight: 400\">proyecto web<\/span> <span style=\"font-weight: 400\">directorio<\/span><span style=\"font-weight: 400\">.<\/span><\/p>\n<pre class=\"lang:default decode:true\">mkdir webproject &amp;&amp; cd webproject\r\nVirtualenv diary<\/pre>\n<p><span style=\"font-weight: 400\">A continuaci\u00f3n, cambie al directorio para activar el entorno virtual mediante los siguientes comandos:<\/span><\/p>\n<pre class=\"lang:default decode:true\">mkdir webproject &amp;&amp; cd webproject\r\n\r\nVirtualenv diary\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Una vez dentro del entorno virtual, podemos instalar paquetes sin miedo a entrar en conflicto con los paquetes del sistema.<\/span><\/p>\n<h2><b>Instalar Flask Framework y otros paquetes<\/b><\/h2>\n<p><span style=\"font-weight: 400\">En esta secci\u00f3n, instalaremos el framework Flask escrito en Python y otros paquetes necesarios para el proyecto.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Vamos a instalar los paquetes que necesitamos para este proyecto usando pip y dpkg.<\/span><\/p>\n<pre class=\"lang:default decode:true\">pip install couchbase\r\n\r\npip install jinja \r\n\r\nPip install flask\r\n<\/pre>\n<p><span style=\"font-weight: 400\">En este tutorial, vamos a ejecutar Couchbase Server a trav\u00e9s de Docker. Necesitas tener Docker en tu localhost o m\u00e1quina de desarrollo para poder <\/span><span style=\"font-weight: 400\">extraiga o descargue im\u00e1genes de Couchbase desde <\/span><a href=\"https:\/\/hub.docker.com\/_\/couchbase\"><span style=\"font-weight: 400\">dockerhub<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Navegue hasta el terminal y escriba lo siguiente para acceder al repositorio de DockerHub:<\/span><\/p>\n<pre class=\"lang:default decode:true\">docker login\r\n<\/pre>\n<p><span style=\"font-weight: 400\">A continuaci\u00f3n, se le pedir\u00e1 que proporcione sus credenciales antes de poder acceder o \"extraer\" im\u00e1genes de DockerHub.<\/span><\/p>\n<pre class=\"lang:default decode:true\">docker pull couchbase\/server\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Es necesario ejecutar los comandos Docker como usuario root.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Sin embargo, si prefieres instalar Couchbase Server manualmente, Couchbase proporciona dos formas de instalaci\u00f3n para distribuciones basadas en Debian y Redat. <\/span><span style=\"font-weight: 400\">Puede consultarlo en <\/span><a href=\"https:\/\/www.couchbase.com\/blog\/es\/downloads\/\"><span style=\"font-weight: 400\">Couchbase<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n<h2><b>Descargar Python SDK 2.5 para Couchbase Server<\/b><\/h2>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">Para acceder al servidor Couchbase, necesitamos descargar el cliente Couchbase SDK para acceder a un cluster Couchbase. <\/span><span style=\"font-weight: 400\">Couchbase proporciona SDK para lenguajes de programaci\u00f3n como Python, .NET y Java.\u00a0<\/span><span style=\"font-weight: 400\">Vamos a descargar e instalar Couchbase SDK para Python usando pip:<\/span><\/p>\n<pre class=\"lang:default decode:true\">pip install couchbase\r\n<\/pre>\n<h2><\/h2>\n<h2><b>Configurar e iniciar Couchbase Server<\/b><\/h2>\n<p><span style=\"font-weight: 400\">Una vez que hayas sacado las im\u00e1genes de Couchbase Server de DockerHub, podemos crear y ejecutar un nuevo contenedor usando el siguiente comando:<\/span><\/p>\n<pre class=\"lang:default decode:true\">docker run -d --name db -p 8091-8094:8091-8094 -p 11210:11210 couchbase\r\n<\/pre>\n<p><span style=\"font-weight: 400\">docker run: Este comando crea una capa contenedora sobre la imagen de Couchbase y la inicia.<\/span><\/p>\n<p><span style=\"font-weight: 400\">-d : La bandera -d significa que el contenedor se ejecuta como un demonio.<\/span><\/p>\n<p><span style=\"font-weight: 400\">-name : Este es el nombre para el nuevo contenedor<\/span><\/p>\n<p><span style=\"font-weight: 400\">-p :  Esta bandera es para la asignaci\u00f3n de puertos<\/span><\/p>\n<p><span style=\"font-weight: 400\">Ahora estamos ejecutando el servidor Couchbase en un contenedor.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Dentro de su navegador, visite https:\/\/localhost:8091 en su m\u00e1quina para configurar el servidor Couchbase.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-7132\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/06\/build1-300x219.png\" alt=\"\" width=\"300\" height=\"219\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build1-300x219.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build1-768x560.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build1-20x15.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build1.png 902w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">Como puede ver, tenemos opciones para crear un nuevo cl\u00faster o unirnos a un cl\u00faster existente. Vamos a elegir la opci\u00f3n de crear un nuevo cl\u00faster \u00fanico. <\/span><span style=\"font-weight: 400\">Establecer un nombre de Cluster, crear un nombre de usuario para <\/span><span style=\"font-weight: 400\">Admin<\/span><span style=\"font-weight: 400\"> y una contrase\u00f1a de 6 caracteres como se muestra a continuaci\u00f3n: <\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-7133\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/06\/build2-300x203.png\" alt=\"\" width=\"300\" height=\"203\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build2-300x203.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build2-768x519.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build2-235x160.png 235w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build2-20x14.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build2.png 844w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">Vamos con la configuraci\u00f3n por defecto. Necesitamos establecer el nombre de host o la direcci\u00f3n IP para nuestro nuevo cluster. No cambiaremos el disco de datos, la ruta del disco de \u00edndices y la ruta del disco de an\u00e1lisis para el prop\u00f3sito de este proyecto.<\/span><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-7135\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/06\/build3-1-270x300.png\" alt=\"\" width=\"270\" height=\"300\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build3-1-270x300.png 270w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build3-1-300x333.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build3-1-18x20.png 18w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build3-1.png 700w\" sizes=\"auto, (max-width: 270px) 100vw, 270px\" \/><\/p>\n<p><span style=\"font-weight: 400\">Adem\u00e1s, no es necesario modificar las cuotas de memoria a menos que no dispongas de suficiente RAM.\u00a0<\/span><span style=\"font-weight: 400\">Por \u00faltimo, se nos presentan dos opciones: iniciar el servidor Couchbase con la configuraci\u00f3n predeterminada o configurar la memoria y los servicios.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Haga clic en el bot\u00f3n que le permite configurar la memoria y los servicios para Couchbase Server. <\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">La secci\u00f3n Nombre de host o direcci\u00f3n IP le permite establecer un nombre de host, por ejemplo <\/span><span style=\"font-weight: 400\">localhost<\/span><span style=\"font-weight: 400\"> o <\/span><span style=\"font-weight: 400\">192.168.15.12<\/span><span style=\"font-weight: 400\">. La ruta del disco de datos le permite definir la ruta.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Entonces <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/5.5\/clustersetup\/create-bucket.html\"><span style=\"font-weight: 400\">crear un cubo<\/span><\/a><span style=\"font-weight: 400\"> llamado \"users-data\" a trav\u00e9s de la consola web de Couchbase. <\/span><\/p>\n<h2><b>Escribir c\u00f3digo del lado del servidor para la aplicaci\u00f3n Agenda<\/b><\/h2>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">S<\/span><span style=\"font-weight: 400\">till dentro de su entorno virtual, cree un archivo<\/span> <span style=\"font-weight: 400\">llamado<\/span><b> app.py<\/b><span style=\"font-weight: 400\">. <\/span><span style=\"font-weight: 400\">Dentro del archivo app.py, copia y pega el siguiente c\u00f3digo:<\/span><\/p>\n<pre class=\"lang:default decode:true\">from flask import Flask \r\nfrom couchbase import Couchbase \r\nclient  = Couchbase.connect(host = \"localhost\", Password = \u201cPassword_here\u201d, bucket = \"Users-data\")\r\n\r\n@app.route('\/home', method=['GET'])\r\ndef home_page():\r\n  return render_template('home.html')\r\n\r\n@app.route('\/home\/create-memo'), method=['POST'])\r\ndef create_memo():\r\n  if method == \u201cPOST\u201d:\r\n     diary = {  \r\n       \"memo\" : request.form[\"memo\"],\r\n       \"year\" : request.form[\"year\"],\r\n      \"month\" : request.form[\"month\"],\r\n      \"day\" :  request.form[\"day\"]\r\n   }\r\n  Key=uuid.uuid1.hex()\r\n  user_doc=json.dumps(diary)\r\n  client.set(key, user_doc)\r\n  return redirect(url_for(\"index\"))\r\nreturn render_view(\"create.html\")\r\n<\/pre>\n<p><span style=\"font-weight: 400\">En el c\u00f3digo anterior, hemos importado el framework Flask, y el cliente Couchbase para Python.\u00a0<\/span><span style=\"font-weight: 400\">A continuaci\u00f3n, nos conectamos al bucket Users-data a trav\u00e9s del m\u00e9todo Couchbase client connect. A continuaci\u00f3n, creamos una ruta para la p\u00e1gina de inicio y la p\u00e1gina create-memo para los usuarios. <\/span><\/p>\n<p><span style=\"font-weight: 400\">Tambi\u00e9n podemos crear una ruta para la p\u00e1gina de mensajes. Esta p\u00e1gina mostrar\u00e1 los mensajes enviados por un usuario. <\/span><span style=\"font-weight: 400\">Dentro del archivo \"app.py\", escribe el siguiente c\u00f3digo para recuperar un mensaje de usuario espec\u00edfico del servidor Couchbase:<\/span><\/p>\n<pre class=\"lang:default decode:true\">@app.route(\u2018home\/saved-messages\u2018, method=[\u2018GET\u2019,\u2018POST\u2019])\r\ndef get saved_messages():\r\n\r\n    Saved_messages = client.get(key)\r\n    Saved_event = json.loads(saved_messages)\r\n\r\n \r\n    if request.method == \u201cPOST\u201d:    \r\n\r\n       Saved_event.memo = request.form[\u201cmemo\u201d]  \r\n       Saved_event.year = request.form[\u201cyear\u201d] \r\n       Saved_event.month = request.form[\u201cmonth\u201d]\r\n       Saved_event.day = request.form[\u201cday\u201d]     \r\n\r\n       user_doc = json.dumps(diary)   \r\n       client.set(key, user_doc)   \r\n       return redirect(url_for(home_page))\r\n    \r\n    return render_template(\u201csaved.html\u201d, model=Saved_event)  \r\n<\/pre>\n<p><span style=\"font-weight: 400\">Dentro del directorio de su proyecto, cree un subdirectorio utilizando el comando mkdir como se muestra a continuaci\u00f3n:<\/span><\/p>\n<pre class=\"lang:default decode:true\">mkdir templates\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Dentro del directorio templates, crea los archivos home.html, savedmemo.html, y postmemo.html con el comando touch:<\/span><\/p>\n<pre class=\"lang:default decode:true\">touch home.html create.html saved.html\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Pegue el siguiente c\u00f3digo dentro del archivo home.html:<\/span><\/p>\n<pre class=\"lang:default decode:true\">&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;Welcome to Daily Memo Book&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt; Remember Your Memorable Events&lt;\/h1&gt;\r\n&lt;p&gt;Welcome to the world of Flask!&lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">Pegue el siguiente c\u00f3digo dentro del archivo memo.html:<\/span><\/p>\n<pre class=\"lang:default decode:true\">&lt;form action=&quot;\/blog\/es\/home\/create-memo\/&quot; method=&quot;post&quot; data-trp-original-action=&quot;\/home\/create-memo&quot;&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=&quot;name&quot;&gt;Nombre:&lt;\/label&gt;\r\n    &lt;input type=&quot;text&quot; id=&quot;name&quot; name=&quot;name&quot;\r\n  &lt;\/div&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=&quot;month&quot;&gt;Month:&lt;\/label&gt;\r\n    &lt;input type=&quot;text&quot; id=&quot;month&quot; name=&quot;month&quot;&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=&quot;year&quot;&gt;Year:&lt;\/label&gt;\r\n    &lt;input type=&quot;text&quot; id=&quot;year&quot; name=&quot;year&quot;&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=&quot;memo&quot;&gt;Memo:&lt;\/label&gt;\r\n    &lt;textarea id=&quot;memo&quot; name=&quot;memo&quot;&gt;&lt;\/textarea&gt;\r\n  &lt;\/div&gt;\r\n&lt;input type=&quot;hidden&quot; name=&quot;trp-form-language&quot; value=&quot;es&quot;\/&gt;&lt;\/form&gt;      \r\n&lt;div class=&quot;button&quot;&gt;\r\n  &lt;button type=&quot;submit&quot;&gt;Send your message&lt;\/button&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Dentro del archivo savedmemo.html, pegue el siguiente c\u00f3digo para generar un formulario que mostrar\u00e1 formularios con mensajes guardados:<\/span><\/p>\n<pre class=\"lang:default decode:true\">&lt;form action=&quot;\/blog\/es\/&rdquo;\/home\/savedmemo&rdquo;\/&quot; method=&quot;&rdquo;POST&rdquo;&quot; data-trp-original-action=&quot;&rdquo;\/home\/savedmemo&rdquo;&quot;&gt;   \r\n   &lt;div&gt;Nombre:  \r\n     &lt;input type=&quot;&rdquo;text&rdquo;&quot; name=&quot;&rdquo;name&rdquo;&quot; values=&quot;&rdquo;{{model.Name}}&rdquo;&quot; \/&gt;   \r\n   &lt;\/div&gt;\r\n  \r\n   &lt;div&gt;Month:   \r\n \r\n     &lt;input type=&quot;&rdquo;text&rdquo;&quot;  name=&quot;&rdquo;month&rdquo;&quot; values=&quot;&rdquo;{{model.Month}}&rdquo;&quot; \/&gt;\r\n   &lt;\/div&gt;   \r\n\r\n   &lt;div&gt;Year:  \r\n\r\n     &lt;input type=&quot;&rdquo;text&rdquo;&quot;  name=&quot;&rdquo;year&rdquo;&quot;  values=&quot;&rdquo;{{model.Year}}&rdquo;&quot;  \/&gt;\r\n\r\n   &lt;\/div&gt;    \r\n\r\n   &lt;div&gt;Memo: \r\n\r\n      &lt;input type=&quot;&rdquo;text&rdquo;&quot;  name=&quot;&rdquo;memo&rdquo;&quot;  values=&quot;&rdquo;{{model.Memo}}&rdquo;&quot;  \/&gt;\r\n\r\n   &lt;\/div&gt; \r\n   &lt;div&gt;  \r\n     &lt;input type=&quot;&rdquo;hidden&rdquo;&quot;  name=&quot;&rdquo;&lt;\/form&quot;&gt;&lt;input type=&quot;hidden&quot; name=&quot;trp-form-language&quot; value=&quot;es&quot;\/&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">Ejecute el siguiente comando para iniciar la aplicaci\u00f3n basada en flask como se muestra a continuaci\u00f3n:<\/span><\/p>\n<pre class=\"lang:default decode:true\">python app.py\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Abra su navegador y navegue hasta la siguiente url para visualizar la p\u00e1gina donde puede enviar los detalles al servidor Couchbase:<\/span><\/p>\n<p><a href=\"https:\/\/localhost.com\/home\/create-memo\"><b>https:\/\/localhost.com\/home\/create-memo<\/b><\/a><\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-7136\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2019\/06\/build4-300x189.png\" alt=\"\" width=\"300\" height=\"189\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build4-300x189.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build4-20x13.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/build4.png 566w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/p>\n<p><span style=\"font-weight: 400\">Adem\u00e1s, si quieres navegar a la p\u00e1gina donde se mostrar\u00e1n los mensajes de los usuarios y pueden ser editados o modificados y guardados antes de enviarlos al Servidor Couchbase, utiliza lo siguiente:<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/127.0.0.1\/home\/saved-messages\/:5000\"><b>https:\/\/localhost.com\/home\/saved-messages\/:5000<\/b><\/a><\/p>\n<p>&nbsp;<\/p>\n<h2><b>Conclusi\u00f3n<\/b><\/h2>\n<p><span style=\"font-weight: 400\">En este tutorial, aprendimos a construir una aplicaci\u00f3n simple de diario basada en Flask con Couchbase Server como backend.<\/span> <span style=\"font-weight: 400\">donde los usuarios pueden enviar datos a trav\u00e9s de un formulario a un servidor Couchbase.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Puede descargar o clonar el proyecto completo desde <\/span><a href=\"https:\/\/github.com\/Rev0kz\/flask-couchbase-demo\"><span style=\"font-weight: 400\">GitHub<\/span><\/a><span style=\"font-weight: 400\"> si quieres probarlo.<\/span><\/p>\n<div class=\"entry-content\">\n<div class=\"entry-content\">\n<p><em>Este art\u00edculo ha sido publicado por Couchbase\u00a0<a href=\"https:\/\/www.couchbase.com\/blog\/es\/community\/community-writers-program\/\">Programa de escritura comunitaria<\/a><\/em><\/p>\n<\/div>\n<\/div>","protected":false},"excerpt":{"rendered":"<p>Michael Aboagye is a backend software\/security engineer based in Ghana. He is interested in building secure backend services with Python. In this tutorial, we will look at how we can build a diary web application based on the flask framework [&hellip;]<\/p>","protected":false},"author":53,"featured_media":7107,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1814,1815,9139],"tags":[],"ppma_author":[9026],"class_list":["post-7117","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-application-design","category-best-practices-and-tutorials","category-python"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.2 (Yoast SEO v26.2) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Build a Diary Web Application with Couchbase as the Back-end - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/es\/diary-web-application\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Build a Diary Web Application with Couchbase as the Back-end\" \/>\n<meta property=\"og:description\" content=\"Michael Aboagye is a backend software\/security engineer based in Ghana. He is interested in building secure backend services with Python. In this tutorial, we will look at how we can build a diary web application based on the flask framework [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/diary-web-application\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2019-06-26T10:11:26+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-06-14T04:10:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1584\" \/>\n\t<meta property=\"og:image:height\" content=\"396\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Laura Czajkowski, Developer Community Manager, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Laura Czajkowski, Developer Community Manager, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/\"},\"author\":{\"name\":\"Laura Czajkowski, Developer Community Manager, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/5f1a0ece4e644bc8c037686fbc8f3220\"},\"headline\":\"Build a Diary Web Application with Couchbase as the Back-end\",\"datePublished\":\"2019-06-26T10:11:26+00:00\",\"dateModified\":\"2025-06-14T04:10:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/\"},\"wordCount\":1039,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png\",\"articleSection\":[\"Application Design\",\"Best Practices and Tutorials\",\"Python\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/\",\"name\":\"Build a Diary Web Application with Couchbase as the Back-end - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png\",\"datePublished\":\"2019-06-26T10:11:26+00:00\",\"dateModified\":\"2025-06-14T04:10:53+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png\",\"width\":1584,\"height\":396},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Build a Diary Web Application with Couchbase as the Back-end\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/5f1a0ece4e644bc8c037686fbc8f3220\",\"name\":\"Laura Czajkowski, Developer Community Manager, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/9deb07d5daaa00220534c31768bc4409\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g\",\"caption\":\"Laura Czajkowski, Developer Community Manager, Couchbase\"},\"description\":\"Laura Czajkowski is the Snr. Developer Community Manager at Couchbase overseeing the community. She\u2019s responsible for our monthly developer newsletter.\",\"url\":\"https:\/\/www.couchbase.com\/blog\/es\/author\/laura-czajkowski\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Build a Diary Web Application with Couchbase as the Back-end - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/es\/diary-web-application\/","og_locale":"es_MX","og_type":"article","og_title":"Build a Diary Web Application with Couchbase as the Back-end","og_description":"Michael Aboagye is a backend software\/security engineer based in Ghana. He is interested in building secure backend services with Python. In this tutorial, we will look at how we can build a diary web application based on the flask framework [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/es\/diary-web-application\/","og_site_name":"The Couchbase Blog","article_published_time":"2019-06-26T10:11:26+00:00","article_modified_time":"2025-06-14T04:10:53+00:00","og_image":[{"width":1584,"height":396,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png","type":"image\/png"}],"author":"Laura Czajkowski, Developer Community Manager, Couchbase","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Laura Czajkowski, Developer Community Manager, Couchbase","Est. reading time":"7 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/"},"author":{"name":"Laura Czajkowski, Developer Community Manager, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/5f1a0ece4e644bc8c037686fbc8f3220"},"headline":"Build a Diary Web Application with Couchbase as the Back-end","datePublished":"2019-06-26T10:11:26+00:00","dateModified":"2025-06-14T04:10:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/"},"wordCount":1039,"commentCount":0,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png","articleSection":["Application Design","Best Practices and Tutorials","Python"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/diary-web-application\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/","url":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/","name":"Build a Diary Web Application with Couchbase as the Back-end - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png","datePublished":"2019-06-26T10:11:26+00:00","dateModified":"2025-06-14T04:10:53+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/diary-web-application\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2019\/06\/PYCBC-no-python.png","width":1584,"height":396},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/diary-web-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Build a Diary Web Application with Couchbase as the Back-end"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/5f1a0ece4e644bc8c037686fbc8f3220","name":"Laura Czajkowski, Directora de la Comunidad de Desarrolladores, Couchbase","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/9deb07d5daaa00220534c31768bc4409","url":"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g","caption":"Laura Czajkowski, Developer Community Manager, Couchbase"},"description":"Laura Czajkowski es la Snr. Developer Community Manager en Couchbase supervisando la comunidad. Es responsable de nuestro bolet\u00edn mensual para desarrolladores.","url":"https:\/\/www.couchbase.com\/blog\/es\/author\/laura-czajkowski\/"}]}},"authors":[{"term_id":9026,"user_id":53,"is_guest":0,"slug":"laura-czajkowski","display_name":"Laura Czajkowski, Developer Community Manager, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/bc8eebaf25cbe39bc12fd7b1ef92550becc3953ab877a3f0285a59ec2d30b754?s=96&d=mm&r=g","author_category":"","last_name":"Czajkowski","first_name":"Laura","job_title":"","user_url":"","description":"Laura Czajkowski es la Snr. Developer Community Manager en Couchbase supervisando la comunidad. Es responsable de nuestro bolet\u00edn mensual para desarrolladores."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/7117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=7117"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/7117\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/7107"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=7117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=7117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=7117"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=7117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}