#NoPayJan Offer - Access all CloudxLab Courses for free between 1st to 31st Jan

  Enroll Now >>

Creating the requirements.txt file

  • A requirements.txt file is where we mention the details of all the packages - along with their corresponding versions - which are used to create the project.

  • This is a very important step in every real-case scenario because the app runs smoothly only if its dependencies are correctly installed.

  • Similarly, Heroku relies on this requirements.txt file to install the dependencies and makes all the necessary arrangements to host the app.

Note:

  • We could create file requirements.txt with the list of all the packages - along with their corresponding versions - which are used in the project using the following command:

    pip freeze > requirements.txt
    
  • Heroku by default uses 3.6 Python runtime. Our Python runtime is of version 2.7.5(you could check this using python -V command). The packages futures and functools32 work only with Python 2. They don't need to be installed in Python3 since they are already included in the standard library. Hence we choose to remove them from requirements.txt.

  • Flask comes with an in-built WSGI(Web Server Gateway Interface) Werkzeug to handle the requests. It is light and easy-to-use in testing and development environments, but it is not suitable for the production environment. Hence we need to switch to another WSGI like gunicorn while deploying an app in production.

INSTRUCTIONS
  • Move to Image-Classification-App directory:

    cd ~
    cd Image-Classification-App
    
  • Activate the virtual environment Img-Class-Env as follows:

    source Img-Class-Env/bin/activate
    
  • Install gunicorn:

    pip install gunicorn
    
  • Execute the following command in the console to create the requirements.txt file:

    pip freeze > requirements.txt
    
  • Use cat requirements.txt in the console. You could see the list of all the packages - along with their corresponding versions - which are used in the project.

    cat requirements.txt
    
  • Open the file using nano requirements.txt and remove the line containing futures module.

  • Also remove the line containing functools32 module.

  • Then click on Ctrl+X, then press y key and hit on Enter.


No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...