How to Build a Data Science Portfolio Website using Python | by Frank Andrade | Towards Data Science

As a data scientist, you need to have a portfolio website that helps you showcase your projects and profile in one place. You might already have a Github and LinkedIn page, but don’t expect a potential employer to look through all your code and posts to know more about you.
Building a portfolio website can be as easy as using a WordPress or GitHub template; however, creating a website on your own will help you add more customization while learning new things you can do in Python.
Although building a website usually requires knowledge beyond Python, we don’t need to become experts in other programming languages to create a portfolio website. This is why I decided to do this guide to walk you through the essential stuff you need to build and deploy your data science portfolio website.
Table of Contents1. Planning the Website - What to include - Get a Custom Domain Name2. How to Build the Website - Backends: Flask vs Django - Front End: Bootstrap (+ HTML, CSS, Javascript)3. Deployment
Before start writing the code to build your portfolio website, take some time to plan what sections the website will have. Make sure your portfolio website has at least some of the sections listed below.
Portfolio: This will be the most important page of the website. List the most important data science projects you’ve finished so far. Add a brief description and a link to the source code. If you’ve written an article about that project, then include the link.
About me: This section will help people know about your skills, background, and anything relevant about you.
Get in touch: Here you should add a form, so people can fill in their name, email, and write a message to get in contact with you. In addition to this, you can add the links to your GitHub and LinkedIn.
If you finished many data science projects and have a lot to write about your experience as a data scientist, create one page per section and then add a landing page that summarizes the other sections. However, if you have little to write about, then one page should be enough to contain all the sections mentioned before.
If necessary add more sections to make your portfolio website stand out.
A domain name is the location of a website. It’s the text that a user types into a browser window to reach a website; for example, the domain name for Google is google.com.
Although we haven't built the website yet, at least you should check the availability of the domain name you wish to have. There are many domain registrars such as GoDaddy and NameCheap where you can see whether the domain name is available or not.
In case the domain name is available, don’t wait until you finish building the website to buy it, otherwise, it might no longer be available after weeks or months. Domain names are usually cheap so in case something goes wrong, you will not lose much money.
Two of the most popular frameworks to build websites with Python are Flask and Django. Django is a high-level Python web framework that enables the developer to create websites without third-party libraries and tools. In contrast, Flask is a microframework that offers the basic features of a web app. It aims to maintain its lightweight simplicity and still extensible usage.
Which one should you use? This will depend a lot on the size of your project. Flask is more suited to smaller, less complicated applications, while Django is designed for larger, more complex, and high-load applications.
If you want to create a simple portfolio website, Flask might be the best option. It’s not only more adequate for small projects, but also the easiest to learn. Flask is more Pythonic than Django because the code of flask Web Application most of the time is more explicit than Django code. This makes Flask easy for Python coders to pick up.
That said, if you plan to create a more complex website with multiple functionalities, you should Django. Also, if you’re into web development, learning Django might be worthier since it’s more popular than Flask. Below there’s a web search comparison I made on Google Trend about these 2 frameworks over a period of 5 years.
The chart above reveals more popularity of Django over Flask. That said, learning any of these frameworks will help you improve your Python skills. You can read a deeper comparison of both frameworks in this article.
There are a lot of free Django and Flask courses available on YouTube. I personally watched this complete Django series where you can learn how to build a blog application. There’s also a Flask series available on the same channel. Another project I tried after learning the basics was this Django Ecommerce Website. After completing those courses you can check this video tutorial that shows an introduction to a very basic portfolio resume website, so you get some inspiration and start building your own.
So far we have successfully built the bones of the website, but to make the website good-looking we need to use other tools.
Web developers need a fair knowledge of HTML, CSS, and Javascript to create a website; however, if our goal is to create a basic data science portfolio website, we can save weeks studying any of those programming languages using Bootstrap.
Bootstrap is a collection of HTML, CSS, and JavaScript tools for creating and building web pages and web applications. With Bootstrap, we can focus on the development work, without worrying about design, and get a good-looking website up and running quickly. On top of that, Bootstrap is mobile-friendly, so the website will still look good on phones
This is great! Thanks to Bootstrap, we don’t need to be experts on JavaScript or CSS to make your website better looking (we still need to know at least the basics though) Below you can find some basic Bootstrap templates you can use for your website.
Starter template
Navigation header
Make sure you follow the Django/Flask free courses I mentioned before. There you will find when and how you should implement these Bootstrap templates in your code.
Note: As I mentioned before, you should at least understand the basics of HTML, CSS, and JavaScript code. In my experience, HTML is used more frequently so consider checking this free HTML course.
So far the website we built can only be accessible on our local machine. Naturally, we want to make our website available for anyone with internet access, so we’re going to use Heroku to take care of it.
Heroku is a platform that allows us to easily deploy and host applications without setting up everything on our own manually. To work with Heroku you have to create an account first. After this, you need to do a couple of things to set up Heroku. This process might take some minutes, so check this video tutorial to learn step-by-step how to deploy your web application with Heroku.
Note: Although you can host a project for free with Heroku, if there’s no web traffic in a 30-minute period, they will put your website to sleep. If someone accesses your website, it will become active after a short delay. To avoid this behavior, you can upgrade to Heroku’s Hobby plan.
That’s it! Now you have a good idea of how to build a basic data science portfolio website using Python. With this, you will be able to customize your website and learn beyond the usual Python stuff we use for data science.
Join my email list with 3k+ people to get my Python for Data Science Cheat Sheet I use in all my tutorials (Free PDF)