简体   繁体   中英

Using Python and Flask in Azure cannot find the requests_file module

In Azure, using Python with the Flask and pandas modules to create a RESTful webservice. Azure doesn't appear able to find the requests_file module.

Launching the web page keeps returning error: No module named requests_file

I have installed "requests" and "requests_file" manually using the Kudu CLI https://"yoursitename".scm.azurewebsites.net/DebugConsole.

They both appear to be there. What am I missing or is there a bug in Azure?

You could configure your requirements.txt file in your flask project.

Put the list of your python modules in the requirements.txt requests==2.18.4

Install wheel module using below command

python.exe -m pip install wheel

Use Below Command to create wheel files inside wheelhouse folder in Local environment

python.exe -m pip wheel -r requirements.txt -w wheelhouse

Then upload your project to your azure web app.

You could use code as below to test requests module

import requests

r= requests.get("https://www.bing.com")
print r.status_code

More details , please refer to this blog and this thread: Publishing MVC app that uses python script

Hope it helps you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM