Push the API to Github
Learn to create a Github repository and push the OCR API to your remote Github repository using the GIT commands discussed earlier
We'll cover the following
Create the requirements.txt
file
We have created successfully the API
in the previous chapter. Now is the time to push it on GitHub. We are doing this because we will be connecting this repository to Azure App Services for CI/CD.
Before doing that, we need to take one important step. We need to create a requirements.txt
file that will contain the dependencies required to run our API
. Follow the steps below to create the file:
-
Activate your virtual environment.
-
Go to your project folder.
-
Run the command shown below:
pip freeze > requirements.txt
-
It will create a
requirements.txt
file in your current directory. Your directory structure should look something like this:./text-analytics-api |- main.py |- utils.py |- requirements.txt
-
Later on we are going to deploy the API on Azure using the same repository, and hence, we need to manually add some packages in the
requirements.txt
file. You need to add the following text at the end of yourrequirements.txt
file:uvloop httptools gunicorn==20.0.4
-
uvloop
: It implements all theasyncio
event loop APIs. This will only be required if you are deploying on a Linux machine. -
httptools
: It is a Python binding for the nodejsHTTP
parser. This will only be required if you are deploying on a Linux machine. -
gunicorn
: Gunicorn ‘Green Unicorn’ is a PythonWSGI
HTTP
Server for UNIX. This will only be required if you are deploying on a Linux machine.
-
You can verify your requirements.txt
file by checking its content as shown below:
Get hands-on with 1200+ tech skills courses.