{"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\/diary-web-application\/","title":{"rendered":"Build a Diary Web Application with Couchbase as the Back-end"},"content":{"rendered":"<p><b>Michael Aboagye is a backend software\/security engineer based in Ghana. <\/b><b>He is interested in building secure backend services with 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\">In this tutorial, we will look at how we can build a diary web application based on the flask framework with Couchbase as the backend server. <\/span><\/p>\n<p><span style=\"font-weight: 400\">By the end of this tutorial, you\u2019ll \u00a0be able to build a simple web application with the Flask framework to send users\u2019 details to a Couchbase server. In addition, you will learn how to set up and configure a Couchbase server.<\/span><\/p>\n<p><b>Prerequisites<\/b><\/p>\n<p><span style=\"font-weight: 400\">You need the following packages to run or clone the project from GitHub.<\/span><\/p>\n<ul>\n<li><b><a href=\"https:\/\/github.com\/pallets\/flask\">Flask framework<\/a> (latest version)<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Flask framework is a micro framework written in Python. It is a micro framework because it does not come with a validation form, authentication mechanism, and so on. It allows you to customize applications in your own way.<\/span><\/p>\n<ul>\n<li><b><a href=\"https:\/\/jinja.pocoo.org\/\">Jinja template<\/a> (latest version)<\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Jinja template is simply a text file which contain variables and expressions, which get replaced when a template is rendered or displayed.<\/span><\/p>\n<ul>\n<li><b><a href=\"https:\/\/www.couchbase.com\/downloads\/\">Couchbase Server<\/a> (community edition) <\/b><\/li>\n<\/ul>\n<p><span style=\"font-weight: 400\">Couchbase Server is a scalable NoSQL document database. We will use the Couchbase server to store users\u2019 data. <\/span><\/p>\n<h2><b>Create a Virtual Environment<\/b><\/h2>\n<p><span style=\"font-weight: 400\">First, create a directory to hold the virtual environment using <\/span><span style=\"font-weight: 400\">mkdir<\/span><span style=\"font-weight: 400\"> command.<\/span><\/p>\n<p><span style=\"font-weight: 400\">The command below creates a directory as<\/span> <span style=\"font-weight: 400\">webproject<\/span> <span style=\"font-weight: 400\">and changes it into the <\/span><span style=\"font-weight: 400\">webproject<\/span> <span style=\"font-weight: 400\">directory<\/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\">Afterwards, change to the diary directory to activate the virtual environment using the following commands:<\/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\">Once we are inside the virtual environment, we can install packages without fear of conflicting with system packages.<\/span><\/p>\n<h2><b>Install Flask Framework and Other Packages<\/b><\/h2>\n<p><span style=\"font-weight: 400\">In this section, we will install Flask framework written in Python and other packages needed for the project.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Let&#8217;s install the packages we need for this project using pip and 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\">In this tutorial, we will run Couchbase Server via Docker. You need to have Docker in your localhost or development machine to be able to <\/span><span style=\"font-weight: 400\">pull or download Couchbase images from <\/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\">Navigate to the terminal and type the following to access the DockerHub repository:<\/span><\/p>\n<pre class=\"lang:default decode:true \">docker login\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Then you&#8217;re prompted to provide your credentials before you can access or &#8220;pull&#8221; images from DockerHub.<\/span><\/p>\n<pre class=\"lang:default decode:true \">docker pull couchbase\/server\r\n<\/pre>\n<p><span style=\"font-weight: 400\">You need to run Docker commands as a root user.<\/span><\/p>\n<p><span style=\"font-weight: 400\">However, if you prefer to install Couchbase Server manually, Couchbase provides two ways of installing for Debian-based and Redat distribution. <\/span><span style=\"font-weight: 400\">You can check it out on <\/span><a href=\"https:\/\/www.couchbase.com\/downloads\/\"><span style=\"font-weight: 400\">Couchbase<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n<h2><b>Download Python SDK 2.5 for Couchbase Server<\/b><\/h2>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">In order to access the Couchbase server, we need to download the Couchbase SDK client to access a Couchbase cluster. <\/span><span style=\"font-weight: 400\">Couchbase provides SDKs for programming languages such as Python, .NET, and Java.\u00a0<\/span><span style=\"font-weight: 400\">Let\u2019s download and install Couchbase SDK for Python using pip:<\/span><\/p>\n<pre class=\"lang:default decode:true \">pip install couchbase\r\n<\/pre>\n<h2><\/h2>\n<h2><b>Configure and Start Couchbase Server<\/b><\/h2>\n<p><span style=\"font-weight: 400\">Once you have pulled Couchbase Server images from DockerHub, we can create and run a new container using the following command:<\/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: This command creates a container layer over the Couchbase image and starts it.<\/span><\/p>\n<p><span style=\"font-weight: 400\">-d : \u00a0The -d flag means the container is run as a daemon<\/span><\/p>\n<p><span style=\"font-weight: 400\">&#8211;name : This is the name for the new container<\/span><\/p>\n<p><span style=\"font-weight: 400\">-p : \u00a0This flag is for port mapping<\/span><\/p>\n<p><span style=\"font-weight: 400\">We are now running the Couchbase server in a container.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Inside your browser, visit https:\/\/localhost:8091 on your machine to configure the Couchbase server.<\/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\">As you can see, we have options to create a new cluster or join an existing cluster. Let\u2019s choose the option to set up a new single cluster. <\/span><span style=\"font-weight: 400\">Set a Cluster name, create username for <\/span><span style=\"font-weight: 400\">Admin<\/span><span style=\"font-weight: 400\"> and a password of 6 characters as shown below: <\/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\">Let&#8217;s go with the default settings. We need to set the hostname or IP Address for our new cluster. We will not change the data disk, Indexes disk path, and Analytics disk path for the purpose of this project.<\/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\">In addition, there is no need to alter memory quotas unless you don\u2019t have enough RAM.\u00a0<\/span><span style=\"font-weight: 400\">Finally, we are presented with two options: start the Couchbase server with default settings or configure memory and services.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Click on the button which allows you to configure memory and services for Couchbase Server. <\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">The Host Name or IP Address section allows you to set a hostname such as <\/span><span style=\"font-weight: 400\">localhost<\/span><span style=\"font-weight: 400\"> or <\/span><span style=\"font-weight: 400\">192.168.15.12<\/span><span style=\"font-weight: 400\">. The Data Disk Path allows you to define the path.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Then <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/5.5\/clustersetup\/create-bucket.html\"><span style=\"font-weight: 400\">create a bucket<\/span><\/a><span style=\"font-weight: 400\"> called \u201cusers-data\u201d via the Couchbase web console. <\/span><\/p>\n<h2><b>Write Server-side Code for Diary Application<\/b><\/h2>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">S<\/span><span style=\"font-weight: 400\">till inside your virtual environment, create a file<\/span> <span style=\"font-weight: 400\">named<\/span><b> app.py<\/b><span style=\"font-weight: 400\">. <\/span><span style=\"font-weight: 400\">Inside app.py file, copy and paste the following code:<\/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\">In the code above, we imported Flask framework, and the Couchbase client for Python.\u00a0<\/span><span style=\"font-weight: 400\">Next, we connected to the bucket Users-data via the Couchbase client connect method. Then, we created a route for the homepage and create-memo page for users. <\/span><\/p>\n<p><span style=\"font-weight: 400\">We can also create a route for the messages page. This page will display message submitted by a user. <\/span><span style=\"font-weight: 400\">Inside the \u201capp.py\u201d file, write down the following code to retrieve a specific user message from Couchbase server:<\/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\">Still inside your project directory, create a subdirectory using the mkdir command as shown below:<\/span><\/p>\n<pre class=\"lang:default decode:true \">mkdir templates\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Inside the templates directory, create home.html, savedmemo.html, and postmemo.html files with the touch command:<\/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\">Paste the following code inside the home.html file:<\/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\">Paste the following code inside the memo.html file:<\/span><\/p>\n<pre class=\"lang:default decode:true \">&lt;form action=\"\/home\/create-memo\" method=\"post\"&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=\"name\"&gt;Name:&lt;\/label&gt;\r\n    &lt;input type=\"text\" id=\"name\" name=\"name\"\r\n  &lt;\/div&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=\"month\"&gt;Month:&lt;\/label&gt;\r\n    &lt;input type=\"text\" id=\"month\" name=\"month\"&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=\"year\"&gt;Year:&lt;\/label&gt;\r\n    &lt;input type=\"text\" id=\"year\" name=\"year\"&gt;\r\n  &lt;\/div&gt;\r\n  &lt;div&gt;\r\n    &lt;label for=\"memo\"&gt;Memo:&lt;\/label&gt;\r\n    &lt;textarea id=\"memo\" name=\"memo\"&gt;&lt;\/textarea&gt;\r\n  &lt;\/div&gt;\r\n&lt;\/form&gt;      \r\n&lt;div class=\"button\"&gt;\r\n  &lt;button type=\"submit\"&gt;Send your message&lt;\/button&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Inside the savedmemo.html file, paste the following code to render a form which will display forms with saved messages:<\/span><\/p>\n<pre class=\"lang:default decode:true \">&lt;form action=\u201d\/home\/savedmemo\u201d method=\u201dPOST\u201d&gt;   \r\n   &lt;div&gt;Name:  \r\n     &lt;input type=\u201dtext\u201d name=\u201dname\u201d values=\u201d{{model.Name}}\u201d \/&gt;   \r\n   &lt;\/div&gt;\r\n  \r\n   &lt;div&gt;Month:   \r\n \r\n     &lt;input type=\u201dtext\u201d  name=\u201dmonth\u201d values=\u201d{{model.Month}}\u201d \/&gt;\r\n   &lt;\/div&gt;   \r\n\r\n   &lt;div&gt;Year:  \r\n\r\n     &lt;input type=\u201dtext\u201d  name=\u201dyear\u201d  values=\u201d{{model.Year}}\u201d  \/&gt;\r\n\r\n   &lt;\/div&gt;    \r\n\r\n   &lt;div&gt;Memo: \r\n\r\n      &lt;input type=\u201dtext\u201d  name=\u201dmemo\u201d  values=\u201d{{model.Memo}}\u201d  \/&gt;\r\n\r\n   &lt;\/div&gt; \r\n   &lt;div&gt;  \r\n     &lt;input type=\u201dhidden\u201d  name=\u201d\r\n\r\n\r\n&lt;\/form&gt;\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p><span style=\"font-weight: 400\">Execute the following command to start the flask-based application as shown below:<\/span><\/p>\n<pre class=\"lang:default decode:true\">python app.py\r\n<\/pre>\n<p><span style=\"font-weight: 400\">Open your browser and navigate to the following url to display the page where you can submit details to the Couchbase server:<\/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\">Also, if you want to navigate to the page where users\u2019 messages will be displayed and can be edited or modified and saved before submitting to Couchbase Server, use the following:<\/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>Conclusion<\/b><\/h2>\n<p><span style=\"font-weight: 400\">In this tutorial, we learned how to build a simple Flask-based diary application with Couchbase Server as the backend<\/span> <span style=\"font-weight: 400\">where users can send data via a form to a Couchbase server.<\/span><\/p>\n<p><span style=\"font-weight: 400\">You can download or clone the whole project from <\/span><a href=\"https:\/\/github.com\/Rev0kz\/flask-couchbase-demo\"><span style=\"font-weight: 400\">GitHub<\/span><\/a><span style=\"font-weight: 400\"> if you want to try it out.<\/span><\/p>\n<div class=\"entry-content\">\n<div class=\"entry-content\">\n<p><em>This post is brought to you by the Couchbase\u00a0<a href=\"https:\/\/www.couchbase.com\/community\/community-writers-program\/\">Community Writing Program<\/a><\/em><\/p>\n<\/div>\n<\/div>\n","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>\n","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.1 (Yoast SEO v26.1.1) - 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\/diary-web-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\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\/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 minutes\" \/>\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\":\"en-US\",\"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\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/diary-web-application\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@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\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@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\":\"en-US\",\"@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\/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\/diary-web-application\/","og_locale":"en_US","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\/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 minutes"},"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":"en-US","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":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/diary-web-application\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@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":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@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":"en-US","@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\/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 is the Snr. Developer Community Manager at Couchbase overseeing the community. She\u2019s responsible for our monthly developer newsletter."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/7117","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/53"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=7117"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/7117\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/7107"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=7117"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=7117"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=7117"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=7117"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}