Hosting your Flask Website on GoDaddy

Photo by Halacious on Unsplash

Whenever someone wants to have their own website, they only think about funky animations and interactions. But once the exciting part of creating the web application in local environment is done, many of us have no clue how to make it available for the world to see. Since this isn’t the fancy work, there aren’t adequate comprehensive resources explaining the process. This blog will try to provide a step-by-step guide for this cumbersome but crucial task.

Although this tutorial is meant for flask web applications, the procedure should be similar for Django or any other python based web framework

Since I have only tried with Flask, I can’t guarantee other python frameworks will behave similarly. Above assumption is due to the procedure I followed didn’t require any flask specific work.

Getting Started

Make sure you have following things up and ready before we start with the hosting:

  1. Flask Application: Sounds obvious, but make sure the application is working in your local environment. Use Pip as your package manager, since GoDaddy Hosting Space supports Pip installations by default. You can choose other package managers like Conda, Poetry, etc. but that will increase your manual workload. Create a requirements.txt list file of your python packages
  2. GoDaddy Domain Name: This is the URL people will be visiting, make sure you have it up and running. You can just try to visit the URL, and confirm that you aren’t running into Page Not Found error
  3. Hosting Space: This is like a linux box on the GoDaddy Servers where you will be putting your code for your domain name to access. You will need to purchase a hosting plan(this is, and you can use external hosting spaces which suits your budget, experience, requirements, etc. This guide only talks about GoDaddy Hosting Space on GoDaddy Domain Name. I have a Starter Linux pack:
GoDaddy Starter Hosting Plan

Once you are done, your My Products section should look something similar to the following and we can proceed with the hosting

Domain name and Web Hosting space purchased

Hosting the Application

Hosting your website is a two step process:

  • Syncing your code on the Hosting Machine
  • Creating a Web Application to Run your code

Syncing Code on Hosting Machine

To sync the code you will need to login into your hosting machine via ssh(use Putty, if you are on Windows). But before that you will have to enable SSH access for the server. You can do this by redirecting to:

Enabling SSH access on your machine

My Products > Web Hosting > Manage > Settings > Server > SSH access > Manage

This takes about 24–48 hours to take effect. Hence, have a good day or two ;)

One the SSH access in On, the IP address mentioned above will be your host address. You can find your credentials in the adjacent Access tab

SSH login credentials

cPanel login is your username and the folder path where you will be syncing your code once logged in

You might need to reset password and relogin on the dashboard for SSH to work

Remote machine supports Github and Python3 by default, if it isn’t you might need to contact customer care to reset your machine (and redo the above steps)

Clone your repository to /home/<username/ or if you prefer you can manually sync your code here using FTP / file transfer tools.

You can also use cPanel Admin (black button as shown above) > Files > File Manager for syncing your code

Creating the Web Application

Once you are done with the code synving part, now it’s time to finally create the server application. For this you will need to goto:
cPanel admin > Software > Setup Pytho App

Click on Create Application, it will redirect you to the following page

  • Select your python version from the drop down. If your version isn’t mentioned you can install it by downloading/transfering the python installer in the Host Machine and restart the machine.
  • Give Application root same name as your code folder
  • Application URL should pick your domain name by default
  • Application startup file, is the entry point for your application that you use to run application in your development environment
  • Application Entry Point, this file will be created by the cPanel. GoDaddy hosts python apps via wsgi, just put in an new python file name(you can just use wsgi.py).
  • Passenger log file path is optional, but recommended.
  • Under Configurations files, add your requirements.txt and trigger the Run pip install. This will install all the code dependencies.

Now, click on the Create button near top right and Voila!!!

We are done and your website is out for the world to see. Have a good day ahead !!! :)

--

--

--

Data Scientist | Artist | Easing into Life | Buy me a coffee!

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

LingoDeer Vs Duolingo: Which One Is Better?

Getting started with Azure Resource Management Templates | ARM templates

A way to setup a GCP driven application with App Engine, Cloud Firestore and React/GraphQL

Formula 1 Comprehensive dashboard —  Part I: Creating a SQL database

Essential parts for learning Apache Kafka quickly

Build a simple address book in Python

LikeCoin Progress Update 2021.08.30

How We Built autom(8) So Fast

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kanishk Varshney

Kanishk Varshney

Data Scientist | Artist | Easing into Life | Buy me a coffee!

More from Medium

PyScript: Python in Web Page

Language translator using googletrans — Python

Organize Files on a Smartphone Using the Lazy Man’s Python File Organizer Script

Build a Free Python Flask Website on Heroku