
Brief Introduction
We@t is the first web-app that I created by using the Django framework. This web-app project will help people find better food choices based on the weather. The concept is very simple: User type the location and the web-app will show a random list of restaurants based on the current weather condition.
This is my portfolio project and I spent about three weeks on creating an idea, developing the algorithm and implementing the web-app. This project was created to help me learn more about the Django framework and practice with APIs in Python. Working on the web-app is also a chance for me to use all the knowledge that I have learned and apply it practically.
The story
I am a food lover and I always want to explore new restaurants for different food experiences. I realized that the time I enjoy the food most is when the food is influenced by the weather condition. For instance, the feeling and the taste when I eat ice cream on a hot summer day is so much better than when I eat on a winter day or when I eat a bowl of hot soup on a winter day, it makes the flavor of the soup enhance to the next level. However, it is very inconvenient for me to find what food should I eat in different weather conditions. Therefore, I decided to create a web-app that can help people, especially busy people, find restaurants based on weather.
To achieve that idea, I had to choose a framework that can support me to build the project, and Django came up to my mind. Django is one of the frameworks that I want to learn and practice and I also wanted to challenge myself with a new framework, so I decided to use Django for my web-app project.
Features and Accomplishments
The above picture is my project architecture. When the users type the location into the website’s search bar, it will send a request to the web application to get the current weather information from weather API to analyze and retrieve a list of restaurants from Yelp Fusion API.
After that, the website will response that list of restaurants to user’s browsers. The information will include the restaurant’s name, price, and a link to that restaurant website.
If users register their email and location, the web-app will store their information to the database and use that database to send a scheduled email to users every day.
In this project, I used HTML, CSS, JavaScript for the front end, and PostgreSQL for the backend. For the APIs, I used Openweathermap API and Yelp API for weather and restaurant data. To send a secured email, I had to use Python libraries: smtplib and ssl. However, to set a schedule for email, I used a Python library called APScheduler to set the time and add that to the website when I deployed my app to Heroku.
Challenges
During the time I developed my web-app, I faced some challenges. The first challenge was when I wanted to create my scheduled email function. I did some research about scheduled jobs in Python and found out that I had to use cron job. Therefore, I decided to use a Python library called python-crontab. However, when I ran the script, I did not see any email that sends to my mail address despite the crontab’s process was running. I had a big struggle to find what was the errors, but I couldn’t. After that, I decided to find a new way to schedule jobs in Python. Fortunately, I found out APSscheduler and apply that library to my script.
The next challenge I had faced was to deploy my app to Heroku. I could not deploy my app to Heroku after many attempts. I checked every step when I deployed my web-app to Heroku to find errors. After researching for the errors, I decided to ask my peers and luckily I found the error. It was a typo when I created my requirements.txt file in Django. I missed the character “s” at the end of the word “requirements”, and that made Heroku fail when I deployed my app.
The last challenge that I had to deal with was to send emails through Gmail. Before I applied the email script to Heroku, I ran it locally to test if it worked. I made a research to learn how to send an email in Python, and I realized that I had to change my Gmail setting to accept my app to send the email. However, this method was unstable and less secure, so I decided to change to a new way by using Gmail two-step verification to create a private password for my app. After testing, the script ran perfectly
What I learned
Developing this project is a great experience for me. Thanks to the project, I can apply all the knowledge that I have learned. I also have the chance to learn and apply a new web framework.
This project also helps me dive deep into the process of creating a new web-app, gain more debugging knowledge, and solve different problems. Therefore, I have more motivation and passion to learn and improve my skill in coding.
About me
I am currently a software engineer student at Holberton School in San Francisco.
Here is some information about my profile:
We@t link
Project source code
My Github
