Google News
logo
Flask - Interview Questions
How to deploy python flask app on Heroku?
Follow the below-mentioned steps to deploy the python flask app on Heroku :
 
* Create a virtual environment with pipenv and install Flask and Gunicorn . - $ pipenv install 
* Create a “Procfile” and write the following code. - $ touch Procfile flask gunicorn 
* Create “runtime.txt” and write the following code. - $ touch runtime.txt 
* Create a folder named “app” and enter the folder. - $ mkdir app, $ cd app
* Create a python file, “main.py” and enter the sample code. -  touch main.py 
* Get back to the previous directory “eflask”.Create a file“wsgi.py” and insert the following code. -$ cd ../ , $ touch wsgi.py
* Run the vitual environment. -$ pipenv shell
* Initialize an empty repo, add the files in the repo and commit all the changes.- $ git init, $ git add .
* - $ git commit -m "Initial Commit" 
* Login to heroku CLI using - heroku login
* Now, Create a unique name for your Web app. -$ heroku create eflask-app
* Push your code from local to the heroku remote. -$ git push heroku master
Advertisement