How to run multiple django applications on IIS server? - django

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.

Related

I can not upload files larger than 35 MB aprox with webserviced + IIS

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!!

Nuget Server Repository - Page not found 404

I'm totally desperate. I've been trying to install Nuget.Server v3.2.1.0 for two days now.
I followed the installation instructions at https://learn.microsoft.com/de-de/nuget/hosting-packages/nuget-server, but it doesn't work.
I suspect that the routing doesn't work properly.
My Web.config looks like:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.web>
<compilation strict="false" explicit="true" debug="true" targetFramework="4.6" />
<!-- maxRequestLength is specified in Kb -->
<httpRuntime targetFramework="4.6" maxRequestLength="30720" />
</system.web>
<appSettings>
<add key="aspnet:UseHostHeaderForRequestUrl" value="true" />
<add key="requireApiKey" value="true" />
<add key="apiKey" value="MyApiKey" />
<add key="packagesPath" value="D:\TFS-Workspaces\Fachit360\Playground\NuGet Server\NuGet Server\Packages" />
<add key="cacheFileName" value="" />
<add key="allowOverrideExistingPackageOnPush" value="false" />
<add key="ignoreSymbolsPackages" value="true" />
<add key="enableDelisting" value="false" />
<add key="enableFrameworkFiltering" value="false" />
<add key="enableFileSystemMonitoring" value="true" />
<add key="allowRemoteCacheManagement" value="false" />
<add key="initialCacheRebuildAfterSeconds" value="15" />
<add key="cacheRebuildFrequencyInMinutes" value="60" />
</appSettings>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" />
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\"Web\" /optionInfer+" />
</compilers>
</system.codedom>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<remove name="WebDAV" />
</handlers>
<staticContent>
<remove fileExtension=".nupkg"/>
<mimeMap fileExtension=".nupkg" mimeType="application/zip" />
</staticContent>
<modules runAllManagedModulesForAllRequests="true">
<remove name="WebDAVModule" />
</modules>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="31457280" />
</requestFiltering>
</security>
</system.webServer>
<system.serviceModel>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true" />
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
...
</assemblyBinding>
</runtime>
</configuration>
And here is my development environment:
- Visual Studio 2017 Pro (15.9.12)
- Windows 10 Enterprise LTSC
- IIS Express 10.0 (Visual Studio integrated)
The installation is very simple. The overview page is also displayed:
What I find confusing is that the Default.aspx file contains the following:
Click here to view your packages.
And in the file NuGetODataConfig.cs the following is configured:
NuGetV2WebApiEnabler.UseNuGetV2WebApiFeed(
config,
"NuGetDefault,
"nuget"
"PackagesOData,
enableLegacyPushRoute: true);
Anyway, when I click on "Click here to view your packages", I get the error: "Page not found - 404".
Does anyone have an idea why that might be? I am at the end of my Latin.
Many greetings
Update
I forgot to mention that I also tried to release the project on a Windows Server 2012 R2. Exactly the same problem.
And it's strange that you can find the following packages in my project references:
- Nuget.Core
- Nuget.server
- Nuget.Server.Core
- Nuget.Server.V2
Then why does the start page talk about Nuget.Server 3.2.1.0?

HTTP Error 500.0 - Internal Server Error Django on iis Error Code 0x00000067

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 facing issues while hosting my Flask web application in IIS

I am using Python3.5, IIS10 to deploy flask web application in iis. Can anyone help me to set up iis with python. I saw many examples but i could not able to do so. I guess the error must be related to web.config
My error is
HTTP Error 500.0 - Internal Server Error C:\Program Files\Python35\python.exe - The FastCGI process exceeded configured request timeout
web.config
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="Bot_Chat.app" />
<add key="PYTHONPATH" value="C:/inetpub/wwwroot/EtownChatBot/;C:\Program Files\Python35;C:\Program Files\Python35\Lib;C:\Program Files\Python35\Lib\site-packages;C:\Program Files\Python35\DLLs;" />
</appSettings>
<system.webServer>
<handlers>
<remove name="CGI-exe" />
<add name="FlaskHandler" path="*" verb="*" modules="FastCgiModule" scriptProcessor="C:\Program Files\Python35\python.exe|"C:\inetpub\wwwroot\EtownChatBot\wfastcgi.py"" resourceType="Unspecified" />
</handlers>
<directoryBrowse enabled="true" />
<security>
<requestFiltering>
<fileExtensions>
<add fileExtension=".py" allowed="true" />
<add fileExtension=".html" allowed="true" />
</fileExtensions>
</requestFiltering>
</security>
</system.webServer>
</configuration>
Add applicationHost.xdt under Your Project directory..
applicationHost.xdt
<?xml version="1.0"?>
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
<system.webServer>
<fastCgi>
<application xdt:Locator="Match(fullPath)" xdt:Transform="SetAttributes(activityTimeout)"
fullPath="C:\Program Files\Python35\python.exe" activityTimeout="600"/>
</fastCgi>
</system.webServer>
</configuration>
Refresh and Restart your Site.Now it will work..

How to deploy Django app on Azure?

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" />