InterviewSolution
| 1. |
How to deploy the Python Flask app on Heroku? |
|
Answer» To deploy the python flask app on Heroku, FOLLOW the procedures outlined below: Create a virtual ENVIRONMENT with pipenv and install Flask and Gunicorn by RUNNING the command - $ 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 virtual 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 main |
|