How I Designed a Personal Portfolio Website with Django (Part 3)

5/5 - (2 votes)

This is the final part of the project tutorial series in which we are learning how to design a personal portfolio website. In the first and second part series, we designed the application and have it running on the local server.

In this final part, we want to move the application to a production server where anyone with the link can see the website and its content. This allows us to share what we have done with others including potential employers.

πŸ’‘ Live Demo: You can see my portfolio app live here:

Deploying Django projects to a live server is not as easy as it is on a local server. Several configurations need to be done. Each hosting platform has its own rules and protocols that need to be observed.

We will deploy our portfolio website on PythonAnywhere for the following reasons:

Reason 1: It is the easiest way to make our website live.

The first point is the main reason I chose PythonAnywhere. I like to keep things simple. Be warned! Hardly will you use Django without dealing with things more complicated than deploying a website. So, expect the worse while you hope for the best.

Reason 2: We can host our website for free.

The second reason is more or less a choice depending on the nature of the website. There are many hosting platforms like Amazon Cloud Services, Google Cloud, and Microsoft Azure but they offer free services for a limited time. Heroku would have been my first choice but they have suspended their free plan.

Steps to Deploy on PythonAnywhere

We will follow a series of steps to deploy our portfolio website on PythonAnywhere. Ensure you have completed the previous parts and that it’s working in the local server before you attempt this final part.

Step 1: Uploading files to GitHub

You can skip this part if you already know how to upload files to GitHub.

Uploading files to GitHub is very simple. You simply go to and register an account if you haven’t already done so. Then you go to to create a new repository.

On the page you are redirected to after creating a new repo, you will see instructions on how to set up GitHub starting with running git init on the command line.

But I want to show you my preferred way of pushing files to GitHub.

Run the following on your terminal assuming you are using Ubuntu and have git installed:

  1. git clone
  2. cd portfolio_website
  3. mv ~/django_projects/portfolio_website/* .
  4. git add .
  5. git commit -m 'initial commit
  6. git push

By following the above steps, your files will be uploaded to GitHub. Now, let me explain what I just did.

I clone the repo in my home directory and cd into it. My username is Jonaben1 and portfolio_website is the name of the Git repository. Make sure you adjust the URL to correspond to yours. Then, I move all files from portfolio_website folder to my current folder which also bears the same name.

Recall, in the first part of this series, we created a folder named portfolio_website. I like the idea of keeping all Django projects in one folder named django_projects. So, inside this folder, I created the portfolio_website folder. Doing this prevents conflict when I clone the repo.

The next command moves all the files (represented by *) to the current folder (represented by the dot). The ~ means the home directory. For further assistance, you may wish to check the internet. Now that our files are pushed to GitHub, we can go to the next step.

Step 2: Create an account on PythonAnywhere

Click here to register an account on the platform. After registration, you log in and be taken to your dashboard as shown below.

Open the bash console and clone your GitHub repo:

git clone

Create and activate a virtual environment

python3 -venv venv
source venv/bin/activate

Change into your project folder

cd portfolio_website

Install Django and its dependencies using the requirements.txt file.

pip install -r requirements.txt

Go back to your dashboard, and click on Web to add a new app.

Select Django as the web framework. Then select the latest Python version (v3.9). Click Next.

Some do recommend setting the app with manual configuration. Well, the choice is yours. Once you arrive at the page, as shown in the image below, you have almost completed the setup.

Hoping that you are still on that page, scroll down to the Code section, you will see β€˜WSGI configuration file,’ click on the link, and you will be taken to an editor. Note that this WSGI file is not the same as the one in your Django project files.

Edit linee 12 and 17. Make it look like this:

Hit save and go back to the Web section. Edit the source code as shown in the image below. In the virtualenv section, enter the whole path of your virtualenv name. Mine is /home/Jonaben/venv

Go back to the bash console. Open your file and save your domain name to the ALLOWED_HOST variable. Mine is Hopefully, everything is all set.

Reload your web app to apply all the changes made. Enter your domain name to the web address in your browser. Your app is now live!


We have successfully come to the end of this project series.

From creating a Django app to deploying to a local server, to uploading files to GitHub, and now, deploying to a production server. No doubt, you have learned a lot. You can now create similar Django project and deploy it instantly to PythonAnywhere.

If you want to make changes to your app, how can you do so?

Quite easy. Either you do it locally, push to GitHub and pull the changes from the bash console or you make the changes directly in the bash console. It all depends on what changes you are making.

For example, you will notice that I applied the changes in the ALLOWED_HOST variable in the file directly rather than pulling from GitHub. This is in case I decide to host my application using other hosting platforms.

Remember, you need to log in to your account at least once every 3 months if you want your app to remain live. Happy coding!

πŸ’‘ Recommended: [Dash + Flask] How to Deploy a Python Dash App on