Closed YoungjaeKim closed 5 years ago
Virtual environments have hard coded paths to the base python path, which can cause problems if you try to reuse them across machines like you are doing here.
I would recommend that you delete it and recreate it using PTVS. Since there's a requirements.txt at the root, PTVS will check the "install packages" in the new virtual env dialog by default.
FYI SuppressWebSitesVirtualEnvError element is meant for the .pyproj file, not the web.config file.
Also so you're aware, we're probably going to remove the virtualenv publishing functionality in the next version (with Visual Studio "15"). We'll recommend the process outlined at https://aka.ms/PythonOnAppService for getting started (and hopefully streamline it a bit by then, but even now we know customers are happier with that approach).
Hi @zooba
I spent hours to setup right web.config
with reference to your link but I failed to run up due to the following error.
scriptProcessor could not be found in application configuration
Could you guide me the correct web.config
setup?
I uploaded my repository (PTVS created) as GitHub Public repo.
d:\home\python35\python.exe -m pip install --upgrade -r d:\home\site\wwwroot\requirements.txt
in Kudu CMD<handler>
error occurred.You can see my web.config
in here; https://github.com/YoungjaeKim/AzureFlaskDemo/blob/master/web.config
I successfully run it with Http Platform handler
guide but it has another problem. It shows almost 8 seconds to process the GET /
request. I think it is by http://stackoverflow.com/q/11150343/361100 problem but AFAIK WebApp does not allow custom hosts
.
I think you need to remove the rewrite rules from your web.config. Otherwise all your URLs are going to have a handler.fcgi
prefix that won't be handled properly.
However, the error makes it look like the applicationHost.xdt
transform in the site extension isn't running properly. There should be some log files in a LogFiles\Transform
folder that might have some extra information, but I've honestly not seen this fail before.
For the HTTP platform handler, do the second and subsequent requests also take 5-8 seconds? It wouldn't surprise me if there was a slow initial startup time but things are fine once the server is running.
@zooba Thanks for supporting me.
I tested HTTP platform handler again and found that it requires initial warm up longer than I expected. I supposed the warm-up would be enough only at the first request but almost 10 times gives fast response.
There's no special message about transformation but let me attach the content.
2016-11-03T07:18:52 sandboxproc.exe C:\DWASFiles\Sites\youngjaeflasktest\Temp\applicationhost.config 2016-11-03T07:18:52 env XPROC_TYPENAME=Microsoft.Web.Hosting.Transformers.ApplicationHost.SiteExtensionHelper, Microsoft.Web.Hosting, Version=7.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 2016-11-03T07:18:52 env XPROC_METHODNAME=Transform 2016-11-03T07:18:52 Start 'python352x86' site extension transform 2016-11-03T07:18:52 StartSection Executing InsertIfMissing (transform line 12, 9) 2016-11-03T07:18:52 on /configuration/system.webServer/fastCgi/application 2016-11-03T07:18:52 Applying to 'fastCgi' element (no source line info) 2016-11-03T07:18:52 EndSection Done executing InsertIfMissing 2016-11-03T07:18:53 Successful 'D:\home\SiteExtensions\python352x86\applicationHost.xdt' site extension transform 2016-11-03T07:18:53 sandboxproc.exe complete successfully. Ellapsed = 309.00 ms
By following your comment, I removed <rewrite>
block in web.config
but still got the same error as below.
scriptProcessor could not be found in application configuration
I'd like to make run Flask with FastCGI as it has more integrated pipeline than self server. Could you test with my repository? or check my web.config again?
Thanks
There's nothing wrong with your web.config - it would seem that something strange is going on with the site itself. If it's easy for you to do, deleting and redeploying the whole thing may fix the issue, otherwise let's dig deeper.
Can you check with the Kudu console that running D:\home\Python35\python.exe -V
displays the version number (3.5.2), and that D:\home\Python35\python.exe -c "import wfastcgi"
doesn't fail? It's possible that the site extension has failed to deploy properly for some reason, which might lead to the error you're seeing. If python.exe isn't actually there, the only way I'm aware of to clean up the site extension is to manually delete it and reinstall. You'll have to delete D:\home\Python35
if it exists, and also D:\home\SiteExtensions\python352x86
, then go through the process of adding it again.
There may be some other log files (in a Kudu
directory, I believe) that indicate why it didn't deploy properly. If you wanted to dig through those and see if there's anything interesting, that will help us make sure it doesn't happen in the future.
Hi. @zooba I got a fresh news. please read.
File system
Python 3.5.2 x86
master
branch.d:\home\python35\python.exe -m pip install --upgrade -r d:\home\site\wwwroot\requirements.txt
and confirmed that everything works fine.D:\home\Python35\python.exe -V
and confirmed that Python 3.5.2
displayed.D:\home\Python35\python.exe -c "import wfastcgi"
and confirmed that output nothing (seems success).<handler> scriptProcessor could not be found in <fastCGI> application configuration
error appeared.Just curious, I tested with Python 3.5.1 x64
extension that you uploaded (besides 3.5.2 is from Microsoft). It shows 500 but different (and understandable) error occurred.
The LogFiles
folder has wfastcgi.log
file which not appeared in 3.5.2.
The error message is as follows;
StdErr: 2016-11-04 02:59:03.208505: Unhandled exception in wfastcgi.py: Traceback (most recent call last): File "D:\home\Python35\wfastcgi.py", line 793, in main env, handler = read_wsgi_handler(response.physical_path) File "D:\home\Python35\wfastcgi.py", line 635, in read_wsgi_handler handler = get_wsgi_handler(os.getenv("WSGI_HANDLER")) File "D:\home\Python35\wfastcgi.py", line 618, in get_wsgi_handler raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb)) ValueError: "app.wsgi_app" could not be imported: Traceback (most recent call last): File "D:\home\Python35\wfastcgi.py", line 602, in get_wsgi_handler handler = import(module_name, fromlist=[name_list[0][0]]) ImportError: No module named 'app' 2016-11-04 02:59:03.208505: Running on_exit tasks 2016-11-04 02:59:03.223345: wfastcgi.py 3.0.0 closed
Wow, now we can confidently say that the FastCgi module is invoked and the only problem is from my directory setup. The Detailed Error Information (htm file) is different also; the 3.5.2
gives 0x80070585
while 3.5.1 has 0x00000000
. So we can assume that two versions do not treat handler
setup in same manner.
wfastcgi.log
file.Ah, excellent. I guess the IIS "could not be found" message actually means "it returned an error". In this case, it appears to be crashing. I'll see whether I can reproduce it.
Until then, you may want to try correcting the WSGI_HANDLER variable in your web.config so that it can be found (I think it should be FlaskWebProject1.app
in your case) and perhaps that will work fine with 3.5.2.
Hi @zooba
I confirmed that 3.5.1
works great with FlaskWebProject1.app
editing as you mentioned. So great finally.
However, 3.5.2
x86 and x64 both give same error as below.
scriptProcessor could not be found in application configuration
You can reproduce with my final repository that I tagged.
Could it be marked as a bug? 🐛
Sure - feel free to file it over at https://github.com/Azure/azure-python-siteextensions
VS 2017 no longer requires a virtual env. Python is installed via site extension.
Symptom
I tried to publish Flask app to Azure WebApp, but failed due to the error message below. Sadly, default Azure Flask template also failed to publish.
Reproduce Steps
env
directory. Project hasPython27 (global default)
as environment.Python Environment
and clickAdd Existing Virtual Environment
.env
directory and it shows "We could not find a base interpreter at D:\Python27" error.Python Environment
and clickAdd/Remove Python Environments
, the dialog showsenv (unavailable)
in environment list.Questions
D:\Python27
in Step 6 and how can I fix it? I do not haveD:
drive and cannot find hard-coded line for that.<SuppressWebSitesVirtualEnvError>true</SuppressWebSitesVirtualEnvError>
in web.config? I cannot find any documentation and example.