Skip to content

Django Application which searches word and sends alert if words length exceeds threshold

Notifications You must be signed in to change notification settings

khadkarajesh/wikipedia-word-search

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Big word search

Problem Definition

Create a django project analyse whether a particular wikipedia page includes alot of big words.

  1. create new branch off of main
    • create django project (follow tutorial https://docs.djangoproject.com/en/3.2/intro/tutorial01/)
    • create app called wiki_stats
    • create services.py file in wiki_stats app
    • In services.py, write a function to fetch summary section of a wikipedia page by passing title argument and using wikipedia api.
    • In services.py, write a second function to interpret the amount of 5+ letter words in the summary section.
    • Return an alert in the second function if more than 20% of words are 5+ letter words.
    • Send an email if an alert exists (https://docs.djangoproject.com/en/3.2/topics/email/)
    • create a function based view in wiki_stats/views (use api_view from django rest framework : https://www.django-rest-framework.org/api-guide/views/#api_view)
      • input request.GET.get('title') and return results of service in previous steps
    • capture screenshot of browser with view response
    • add requirements.txt file with project dependencies
    • add README for how to run your project
  2. create pull request of your branch pointing to branch:main with screenshot in PR description

Enable Email Service

Email service needs to be configured for sending email once the summary contains the more than 20 percentage of words with length greater than 5. I have used gmail as email sender. To configured it, need to set the environment variable in file .env on root directory of project.

wordsearch/.env

MAIL_PORT=587
MAIL_PASSWORD=YOUR_SENDER_GMAIL_PASSWORD
SENDER_EMAIL=SENDER_GMAIL_ADDRESS
RECEIVER_EMAIL=RECEIVER_GMAIL_ADDRESS
SMTP=smtp.gmail.com

Run Application

Change to the root directory of the project as

  1. Navigate to root directory
cd wordsearch
  1. Run Application
 python manage.py runserver

Run Test

  1. Change directory to wiki_stats app as:
 cd wiki_stats
  1. Run tests as:
pytest

Screenshot of application

About

Django Application which searches word and sends alert if words length exceeds threshold

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages