RakshaBandhan :- A token of Gratitude

Hi guys, it’s been a long time since I have posted something.

I would like to share my perspective of Raksha Bandhan here.I thought even this time I will be missing to celebrate RakshaBandhan with my brothers as it has happened before year. But , thanks to Onam Vacation I could go home and spend this RakshaBandhan with my brothers.

All these years since my childhood I use to see RakshaBandhan as a festival for receiving gifts. But now as I am little matured and as I am far away from my brother, I could feel the real love and affection for him.I have one own brother and two cousin brothers who are very close to me.I used to tie a Rakhi to all the boys in my locality who don’t have sisters.

rakhi

But, I think this RakshaBandhan I thought it should be something different and yes I celebrated it differently.Firstly, I tied Rakhi to my brother this time not because he gives me gifts but it is because the token of gratitude I wanted to offer to him everytime he valued my interests and he let me follow my passion and when I decided to study in kerala he was the one who supported me the most. I never took time to thank him but this RakshaBandhan I tied him Rakhi as a token of gratitude rather than for his gifts.I tied him Rakhi not asking him to protect me but rather asking him to protect my self respect as he has done before.

This time I tied Rakhi to our WatchMan who was there since my childhood. He was the one who use to see it that I go to school safely and be safe on roads while I play on roads. He was infact there for every small thing and he was actually my protector in all ways.SO, this time I felt it’s necessary to tie rakhi to him as a token of gratitude which I couldn’t express all these days.

Apart from these I really wish I could I have got a chance to tie rakhi to our dear brother who keeps fighting for us near the borders and ready to face any challenge thrown on him at any point of time so that we can have a peaceful sleep with a smile on our face.But , this couldn’t happen as I didn’t get an oppurtunity.

It has been a really wonderful experience for me this RakshaBandhan tying rakhis to the real heroes of my life. And I  encourage everyone to do the same.Friends it’s time that we give them a token of gratitude to all those real heroes of our life who protected our self respect and were there with us like our strength during all the times.

 

 

Advertisements

BLOG-AGGREGATOR

Hello,

In this blog I am going to explain  how I did my first project on blog aggregator using django.

What is a blog aggregator?

A Blog Aggregator  is a client application or website that aggregates syndicated content such as news headlines, blogs and podcasts in a single location for easy viewing.

First thing to be done is to import rss feed from a website.Using django and python I created a blog aggregator. The following are the steps:

 

Django

First thing to do is to create a virtual environment so that our django project works. Then start a django project. Then start an app and add the name of the app in the settings.py file inside the project.

 

Now it’s time to work within the app,

It’s time to create some models for the app.

   Models.py

Type the following:

class link(models.Model):
url = models.CharField(max_length=250)

def __str__(self):
return self.url

Here, we are creating a class in which an object called url whose maximum length should be mentioned compulsorily. Then define a function __str__ so that we can view that url.

 

       Urls.py

Type the following:

from . import views

urlpatterns = [
url(r’^search-form’, views.feed, name = ‘feed’),
url(r’^search’, views.search, name = ‘search’),

Here, I am importing views into this file and then create url patterns for us to access the respective html pages.We need to give the names of the views as attributes inside the urls and a name must be given.

            Templates

Now it’s time to create an attractive html page using bootstrap for our blog aggregator’s home page.

Type the following:

<head>
  <title>BLOG AGGREGATOR</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <style>
  body  {
    background-image: url("https://www.planwallpaper.com/static/images/violet-vector-leaves-circles-backgrounds-for-powerpoint_PdfkI4q.jpg");
    
  }
  </style>
</head>
<body>
<form action="/index/results/" method="get">
      <h1 align="center" style="font-size: 100px; color: white"><u>Enter the url</u></h1>
        <div align="center"><input type="text" name="sp">
        <input type="submit" value="Search"></div>
    </form>
</body>

 

A form must be created then an input box is created in that.

 

          Views.py

from django.shortcuts import render
from . import forms
from . import models
from django.http import HttpResponse
import re
import feedparser
# Create your views here.

def feed(request):
return render(request, ‘rss_feed/home.html’)

def search(request):
if ‘i’ in request.GET:
try:
d = feedparser.parse(request.GET[‘i’])
s = d[‘feed’][‘title’] + ‘\n’ + d[‘feed’][‘description’] + ‘\n’
for post in d.entries:
s = s + ‘\n’ + post.title + ‘\n’
su = post.summary
su = re.sub(‘<.*?>’,”,su)
s = s + ‘\n’ + su + ‘\n’
for post in d.entries:
s = s + post.link
models.link(url = request.GET[‘i’]).save()
return HttpResponse(s)
except KeyError:
return HttpResponse(“rss feed is not valid”)
else:
message = ‘form is empty’
return HttpResponse(message)

 

In this, we are importing forms,render,models,HttpResponse,re,feedparser. Then we define a function named feed which returnd the rss feed saved in the html page. Then define another function named search. Inside it for every i inside the html page , I am assigning d to the parsed data and then for every post in i  it is defined as s as itself plus post title. Then sm is defined as post summary and next line is regular expression. Then for every post in i I added post link to the data gathered.Then this is saved in the url and then it is returned as a HttpResponse of d. If the rss feed is not valid then an error message is displayed that RSS field is not valid.

 

                  THANK YOU