Web701 20

May 20, 2019
Web701 Python Django Heroku Web Hosting

Web Development 701 ~ Heroku and Web Hosting

We wrapped up the web implementation in the last blog with the addition of the auction system. Now it’s time to deploy the website to a web hosting service. There are two options that are available for the deployment, my tutors remote server, or a PaaS (Platform as a Service) provider like Heroku.

I want to get experience in both so I will deploy on both, but since the dependancies I require for the website are not yet installed on the tutor’s server I will start with deploying on Heroku.

Before deployment to Heroku there are a few changes that need to be made to the repository. One of the first things we need to do is add web701.herokuapp.com to the ALLOWED_HOSTS list in the settings.py file under the web701 directory. We need to add a Procfile which is essential and “specifies the commands that are executed by the app on startup.” [source]. We also need a runtime.txt file, and a requirements.txt file. These files need to be in the root directory of the application. We also need to install the heroku-cli.

When I first tried to deploy the application I was running into the following issue.

No default language could be detected for this app.

I figured out it was because the repository was setup in the following way.

|- root dir
    |- env
    |- README.md
    |- django app
        |- ...

By changing it to the following it solved this problem.

|- django app
    |- ...

I also ran into the following error.

Requested runtime (Python 3.7.3) is not available for this stack (heroku-18).

Which this problem was simply a syntax error and was solved by changing the runtime.txt file from Python 3.7.3 to python-3.7.3.

Now to create a Heroku app via heroku create <appname> --buildpack heroku/python and deploy it via git push heroku master. With that we now have a live web application available to the public. Not sure if I will continue to keep the application hosted but the url is https://web701.herokuapp.com.

Web701 22

June 15, 2019
Web701 Serverless OpenFaas Docker CLI Python Digital Ocean

Web701 21

May 21, 2019
Web701 VirtualBox Serverless OpenFaas Docker CLI Python

Web701 19

May 14, 2019
Web701 Python Django Auction system
comments powered by Disqus