I have posted before but not received an answer.
I have a Django web app developed in VS2017. I have published it but getting a server error. Can you please advise how I need to configure my web.config file so that it works? Currently it's:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<appSettings>
<add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
<add key="WSGI_HANDLER" value="app.wsgi_app"/>
<add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
</appSettings>
<system.webServer>
<handlers>
<add name="PythonHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\Python361x64\python.exe|D:\home\Python361x64\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
</handlers>
</system.webServer>
</configuration>
but I am getting an server error and Python log file says:
D:\home\Python361x64\python.exe: can't open file 'D:\home\site\wwwroot\runserver.py': [Errno 2] No such file or directory
I would appreciate any help.
You need to add static files url configuration to web.config file on KUDU which mentioned here.
I've tried to deploy my own Django project to azure and use your web.config file,and it works well.
You could refer to the web.config configuration as below:
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="DjangoWebProject1.wsgi.application"/>
<add key="PYTHONPATH" value="D:\home\site\wwwroot"/>
<add key="WSGI_LOG" value="D:\home\LogFiles\wfastcgi.log"/>
</appSettings>
<system.webServer>
<handlers>
<add name="PythonHandler" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\python362x86\python.exe|D:\home\python362x86\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
</handlers>
<rewrite>
<rules>
<rule name="Static Files" stopProcessing="true">
<conditions>
<add input="true" pattern="false" />
</conditions>
</rule>
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Note:
Please make sure the value of path property in
<add name="PythonHandler" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\home\python362x86\python.exe|D:\home\python362x86\wfastcgi.py" resourceType="Unspecified" requireAccess="Script"/>
is the same as the value of url property in
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
Related
I am new in django that runs on IIS server. I have manage to set up server that one django application/site is runnging..now I want to add another django application/site to this server. I cant find anywhere the sample web.config how to do that..
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />
<mimeMap fileExtension=".config" mimeType="application/xml" />
<mimeMap fileExtension=".pdb" mimeType="application/octet-stream" />
</staticContent>
<handlers>
<add name="Python FastCGI"
path="/page1/*"
verb="*"
modules="FastCgiModule"
scriptProcessor="c:\python27\python.exe|c:\python27\lib\site-packages\wfastcgi.pyc"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<add key="WSGI_HANDLER" value="page1.wsgi.application" />
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\page1" />
<add key="DJANGO_SETTINGS_MODULE" value="page1.settings" />
</appSettings>
</configuration>`
This is my config so far, how can I add another django site that will be available on URL/page2/ ?
To create a new site click on the server name and add a new website.
enter your site folder path and binding detail.
and copy your old web.config file to the new create site folder and make changes that you want.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<staticContent>
<mimeMap fileExtension=".apk" mimeType="application/vnd.android.package-archive" />
<mimeMap fileExtension=".config" mimeType="application/xml" />
<mimeMap fileExtension=".pdb" mimeType="application/octet-stream" />
</staticContent>
<handlers>
<add name="Python FastCGI"
path="/page2/*"
verb="*"
modules="FastCgiModule"
scriptProcessor="c:\python27\python.exe|c:\python27\lib\site-packages\wfastcgi.pyc"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
</system.webServer>
<appSettings>
<add key="WSGI_HANDLER" value="page2.wsgi.application" />
<add key="PYTHONPATH" value="C:\inetpub\wwwroot\page2" />
<add key="DJANGO_SETTINGS_MODULE" value="page1.settings" />
</appSettings>
</configuration>
Note: use python version after 3.6 with iis if possible.
I have a website (ASP.NET core) with an ajax + base64 function to upload files.
When I pick a file from 0-29 MB aprox works perfect, but If i pick a larger file, does not upload.
My web.configs;
Web.config (app side)
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\AppName.exe" arguments="" stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" forwardWindowsAuthToken="true">
<environmentVariables />
</aspNetCore>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
<rewrite>
<rules>
<rule name="HTTP A HTTPS" enabled="false" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{HTTPS}" pattern="^OFF$" />
</conditions>
<action type="Redirect" url="https://{HTTP_HOST}{REQUEST_URI}" appendQueryString="false" />
</rule>
</rules>
</rewrite>
</system.webServer>
<system.web>
<!-- <httpRuntime maxRequestLength="2147483647" /> -->
</system.web>
</configuration>
And web.config (webservice)
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="..." value=".....=" />
<add key="..." value=".....=" />
<add key="..." value=".....=" />
<add key="..." value=".....=" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<authentication mode="Windows" />
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID" />
<httpRuntime maxRequestLength="2147483647" maxQueryStringLength="2097151" />
</system.web>
<system.webServer>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824" />
</requestFiltering>
</security>
</system.webServer>
</configuration>
I tried some parameters that I found in other questions like this. maxAllowedContentLength,maxRequestLength, maxUrlLenght... but any works.
I think maxAllowedContentLength="1073741824" should be 1 GB aprox.
But I do not if it is correct.Neither if change would be in web.config site,web.config webserver or both.
Any idea?
Thanks!!
I'm trying to makedjango web app work on IIS using wfastcgi
Following This guide it gave me the error code 0x00000067
and here is my web.config file :
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<handlers>
<add name="AccuManager" path="*" verb="*" modules="FastCgiModule" scriptProcessor="E:\projectInnoventiq\accuManager\venv\Scripts\python.exe|E:\projectInnoventiq\accuManager\venv\Scripts\wfastcgi.py" resourceType="Unspecified" />
</handlers>
<httpErrors errorMode="Detailed" />
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,FastCGI,WebSocket" verbosity="Verbose" />
</traceAreas>
<failureDefinitions timeTaken="00:00:00" statusCodes="500" />
</add>
</traceFailedRequests>
</tracing>
</system.webServer>
</configuration>
I am having some trouble setting up my website on Azure. My website is developed using Django and I am using wfastcgi to run it on the server; but the server keeps giving an error that says, "scriptProcessor could not be found in application configuration." Here is the error exactly:
Here is my web.config file:
<?xml version="1.0"?>
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
<add key="PYTHONPATH" value="D:\home\Python27" />
<add key="DJANGO_SETTINGS_MODULE" value="iasf.settings" />
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="Python27_via_FastCGI" />
<remove name="Python34_via_FastCGI" />
<add name="Python FastCGI"
path="handler.fcgi"
verb="*"
modules="FastCgiModule"
scriptProcessor="D:\home\Python27\python.exe|D:\home\Python27\Lib\site-packages\wfastcgi.py"
resourceType="Unspecified"
requireAccess="Script" />
</handlers>
<rewrite>
<rules>
<rule name="Static Files" stopProcessing="true">
<conditions>
<add input="true" pattern="false" />
</conditions>
</rule>
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite"
url="handler.fcgi/{R:1}"
appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
I've installed wordpress in Azurewebsites which is primarily running Django. I've set up an application as /blog to /site/wwwroot/blog in application setting.
But web.config is not serving the url www.example.com/blog instead it's throwing 404 error.
Here's the web.config, could you suggest how to disable rewrite for www.example.com/blog
<?xml version="1.0"?>
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
<appSettings>
<add key="WSGI_ALT_VIRTUALENV_HANDLER" value="django.core.wsgi.get_wsgi_application()" />
<add key="WSGI_ALT_VIRTUALENV_ACTIVATE_THIS" value="D:\home\site\wwwroot\env\Scripts\python.exe" />
<add key="WSGI_HANDLER" value="ptvs_virtualenv_proxy.get_venv_handler()" />
<add key="PYTHONPATH" value="D:\home\site\wwwroot" />
<!--
<add key="WSGI_PTVSD_SECRET" value="" />
-->
</appSettings>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<!-- Required for websockets. -->
<httpRuntime targetFramework="4.5"/>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true" />
<handlers>
<remove name="Python340_via_FastCGI" />
<add name="Python FastCGI" path="handler.fcgi" verb="*" modules="FastCgiModule" scriptProcessor="D:\Python34\python.exe|D:\Python34\Scripts\wfastcgi.py" resourceType="Unspecified" requireAccess="Script" />
<!-- Uncomment the following handler to enable remote debugging. -->
<!--
<add name="ptvsd" path="ptvsd" verb="*" resourceType="Unspecified" type="Microsoft.PythonTools.Debugger.WebSocketProxy, Microsoft.PythonTools.WebRole"/>
-->
<!-- <clear/>
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule" resourceType="File" requireAccess="Read" />
-->
</handlers>
<rewrite>
<rules>
<!-- Uncomment the following rule to enable remote debugging. -->
<!--
<rule name="ptvsd" enabled="true" stopProcessing="true">
<match url="^ptvsd(/.*)?$"/>
</rule>
-->
<rule name="Static Files" stopProcessing="true">
<conditions>
<add input="true" pattern="false" />
</conditions>
</rule>
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
</rule>
</rules>
</rewrite>
<staticContent>
<clientCache cacheControlMaxAge ="7.00:00:00" cacheControlMode="UseMaxAge" />
</staticContent>
</system.webServer>
</configuration>
According to your description, I suggest you could try to add a not match condition in the rules.
If the url's target is blob folder, then it will not be rewrite.
More details, you could refer to below config.
<rule name="Configure Python" stopProcessing="true">
<match url="(.*)" ignoreCase="false" />
<conditions>
<add input="{REQUEST_URI}" pattern="^/static/.*" ignoreCase="true" negate="true" />
<add input="{URL}" pattern="^/blog/.*" ignoreCase="true" negate="true" />
</conditions>
<action type="Rewrite" url="handler.fcgi/{R:1}" appendQueryString="true" />
</rule>
The result is like below: