<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Debashish Palit</title>
    <description>The latest articles on DEV Community by Debashish Palit (@deb17).</description>
    <link>https://dev.to/deb17</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F462588%2F12d6af6d-8509-488a-837a-b33562fcdcd6.jpeg</url>
      <title>DEV Community: Debashish Palit</title>
      <link>https://dev.to/deb17</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/deb17"/>
    <language>en</language>
    <item>
      <title>Blogfinder - submission post for the DO hackathon</title>
      <dc:creator>Debashish Palit</dc:creator>
      <pubDate>Tue, 05 Jan 2021 14:26:00 +0000</pubDate>
      <link>https://dev.to/deb17/blogfinder-submission-post-for-the-do-hackathon-256f</link>
      <guid>https://dev.to/deb17/blogfinder-submission-post-for-the-do-hackathon-256f</guid>
      <description>&lt;h2&gt;
  
  
  What I built
&lt;/h2&gt;

&lt;p&gt;The BlogFinder web-app has a simple aim - to publicize personal blogs.&lt;/p&gt;

&lt;p&gt;Say you have a blog that you've built with care. You don't want to migrate it to sites like Medium, Blogger or Hashnode and use their platforms. If you want to maintain the blog and need viewership, then this app will help you.&lt;/p&gt;

&lt;p&gt;It's not just a list of blog sites. It shows you the summaries of the latest posts made on the personal blog sites of all its users. The main attraction is the Explore page which gives a combined view of the feeds and the entries made manually.&lt;/p&gt;

&lt;p&gt;Additionally, this site is a social platform where users can follow and like each other, and view profiles.&lt;/p&gt;

&lt;h3&gt;
  
  
  Category Submission:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Random Roulette&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  App Link
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://blogfinder-kesza.ondigitalocean.app"&gt;https://blogfinder-kesza.ondigitalocean.app&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Screenshots
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--yitiISWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hte1l1nnchnzu7hwerfr.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--yitiISWy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/hte1l1nnchnzu7hwerfr.jpg" alt="Index page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_odSnfv3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gjdha9etkvsn3a8mwj1g.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_odSnfv3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/gjdha9etkvsn3a8mwj1g.jpg" alt="Explore page"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Description
&lt;/h3&gt;

&lt;p&gt;There are two ways in which the app achieves its goal. Firstly, when a user submits his/her blog url, the RSS feed, if any, gets detected. This is used to pick out the latest post summary. The other way is by making manual entries of blog summaries on the site, which show up on the Home page (apart from the Explore page).&lt;/p&gt;

&lt;p&gt;The challenging part of the design was scalability. What happens when the number of users grows and there are hundreds of feeds? Not to worry - Async to the rescue. I chose the Python Quart framework to make async requests to fetch feeds. By using coroutines, the app can scale up to a high number of simultaneous requests. The feeds are cached for a duration that is configurable.&lt;/p&gt;

&lt;h3&gt;
  
  
  Link to Source Code
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/deb17/blogfinder"&gt;https://github.com/deb17/blogfinder&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Permissive License
&lt;/h3&gt;

&lt;p&gt;MIT&lt;/p&gt;

&lt;h2&gt;
  
  
  Background
&lt;/h2&gt;

&lt;p&gt;I am a self-taught developer. I have a personal site and blog. But the blog is not successful. I had a look at the popular options available. Hashnode came closest to what I wanted. It allows custom domains, but still you have to write on its platform. So I came up with this idea of popularising blogs of developers like me.&lt;/p&gt;

&lt;h3&gt;
  
  
  How I built it
&lt;/h3&gt;

&lt;p&gt;This app is built with &lt;strong&gt;Quart&lt;/strong&gt; (asynchronous Flask), &lt;strong&gt;Vue&lt;/strong&gt; and &lt;strong&gt;Bulma&lt;/strong&gt;.  Quart helps in making async requests to fetch feeds. Vue is used to make an api call to the server to get the posts - a process that takes some time - and to easily handle the JavaScript needed to render them.&lt;/p&gt;

&lt;p&gt;Building the app with &lt;strong&gt;Digital Ocean's App platform&lt;/strong&gt; is thankfully not complicated. I just had to provide my docker file and tweak the yaml spec. Also it's nice to get a free and secure domain.&lt;/p&gt;

&lt;p&gt;Please note that the demo app features some example blogs. The blog owners are not using the site.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources/Info
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;There is an old Python cookbook &lt;a href="https://flylib.com/books/en/2.9.1.291/1/"&gt;recipe&lt;/a&gt; of 2004 which does a similar thing. It builds an RSS aggregator with the Twisted framework. This shows that my idea behind the app is feasible. I have, of course, not used any of its code.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Log in with username 'deb' and password 'pass123', or create new credentials. &lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;(Cover) Image by &lt;a href="https://pixabay.com/users/sophieja23-698836/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=684748"&gt;Sophie Janotta&lt;/a&gt; from &lt;a href="https://pixabay.com/?utm_source=link-attribution&amp;amp;utm_medium=referral&amp;amp;utm_campaign=image&amp;amp;utm_content=684748"&gt;Pixabay&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dohackathon</category>
      <category>python</category>
      <category>vue</category>
    </item>
    <item>
      <title>Completed the app. About to deploy.</title>
      <dc:creator>Debashish Palit</dc:creator>
      <pubDate>Wed, 30 Dec 2020 15:07:48 +0000</pubDate>
      <link>https://dev.to/deb17/completed-the-app-about-to-deploy-2m52</link>
      <guid>https://dev.to/deb17/completed-the-app-about-to-deploy-2m52</guid>
      <description>&lt;p&gt;I completed the coding of my Blogfinder app! The past few days I worked on -&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Profile and home pages&lt;/li&gt;
&lt;li&gt;User follow and like features&lt;/li&gt;
&lt;li&gt;Managing of posts&lt;/li&gt;
&lt;li&gt;Testing&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some issues I faced were -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Post publish dates&lt;/strong&gt; - I used moment to get a relative date from a timestamp (number of seconds). The peculiar thing that I noticed when working with Docker containers was that, by default, the timezone was UTC. This was causing the Python &lt;code&gt;datetime&lt;/code&gt; module's &lt;code&gt;timestamp&lt;/code&gt; function to give a wrong value for naive datetimes. I first thought it was a bug in Python. StackOverflow pointed out that docker was the problem and I had to add the following to the docker-compose file:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;volumes:
  - /etc/localtime:/etc/localtime
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This worked but then I decided on another approach. That was to use aware-datetimes with the following code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;post.published = post.published.astimezone(timezone.utc)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;N+1 problem&lt;/strong&gt; - I have a Post, a UserProfile and a User table. When there are many posts to get, the number of database queries to get the username from the User table and the fullname from the UserProfile table will be high. I chose to defer the queries to when there will be a few posts to serve (after pagination).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For testing, I created a number of dummy users with real personal blogs. I plan on creating similar dummy data on the deployed demo app as well. I hope the blog owners won't mind!&lt;/p&gt;

&lt;p&gt;Tomorrow I will perform another round of testing and then deploy the app. After that, I will make the final submission post.&lt;/p&gt;

</description>
      <category>dohackathon</category>
    </item>
    <item>
      <title>Adding auth to the app</title>
      <dc:creator>Debashish Palit</dc:creator>
      <pubDate>Sat, 26 Dec 2020 16:31:57 +0000</pubDate>
      <link>https://dev.to/deb17/adding-auth-to-the-app-14nj</link>
      <guid>https://dev.to/deb17/adding-auth-to-the-app-14nj</guid>
      <description>&lt;p&gt;I was busy adding auth functionality to my Blogfinder app the last few days. It is an essential, though not main, part of the app. Adding auth is quite routine, but, by no means, a trivial task. I had to code the views, forms and templates. Took some code from the &lt;a href="https://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world"&gt;Flask mega tutorial&lt;/a&gt;. Flask-login and flask-mail play nicely with the framework I have chosen - quart.&lt;/p&gt;

&lt;p&gt;I struggled with the password reset email functionality. Sending async emails with quart and flask-mail is not straight-forward. I was constantly getting a &lt;code&gt;coroutine not awaited&lt;/code&gt; warning when trying to run a sync function from a thread started by the async route. I had to take help from a forum post by quart's creator to solve the issue.&lt;/p&gt;

&lt;p&gt;I completed the login, register and password-reset parts of the application. Then I started working on the profile page. I add the routes and forms for the profile add and edit pages. Tomorrow I will start with showing the profile page and then move onto the "user follow" functionality which, I suppose, will take quite a bit of time. &lt;/p&gt;

</description>
      <category>dohackathon</category>
    </item>
    <item>
      <title>Starting to code the Blogfinder app</title>
      <dc:creator>Debashish Palit</dc:creator>
      <pubDate>Wed, 23 Dec 2020 15:49:46 +0000</pubDate>
      <link>https://dev.to/deb17/series-digital-ocean-hackathon-49nl</link>
      <guid>https://dev.to/deb17/series-digital-ocean-hackathon-49nl</guid>
      <description>&lt;p&gt;I decided to take the plunge and code a web-app for the hackathon. I started a couple of days ago with a blog aggregator app. The aim of the app is to attract viewership for personal blogs. Users of the site can submit summaries of their blog posts and they will appear on the site for all to see. The site is also a social platform where users can follow each other and like each other.&lt;/p&gt;

&lt;p&gt;Tech stack - Quart (Python), Vue and Bulma&lt;br&gt;
Database - Postgresql&lt;/p&gt;

&lt;p&gt;So far I have built the route to view all posts and set up the database models.&lt;/p&gt;

&lt;p&gt;I have decided to develop with Docker using VS Code's Remote Containers extension. &lt;/p&gt;

</description>
      <category>dohackathon</category>
    </item>
  </channel>
</rss>
