Reputation: 49
I have created a Django sample app and want to host it as Azure app service. I have followed some articles but not got success with anyone. Is there step by step documentation to do so or can anyone help me out in this?
I have created an app service on Azure Connected it with ftp There was a single file named hostingstart.html inside wwwroot I have copied the sample app in the wwwroot folder but unable to browse the app, the azure app link showing the default page
Upvotes: 2
Views: 2664
Reputation: 23792
Please refer to my work steps and check if you missed something.
Step 1: Follow the official tutorial to create your azure python web app.
Step 2: Add Python extension.
Step 3: Add web.config
file and deploy your web app.
<configuration>
<appSettings>
<add key="WSGI_HANDLER" value="<your project name>.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\python361x64\python.exe|D:\home\python361x64\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>
Step 4: Install pip plugin
in your python extension environment
.
Step 5: Install django
module and other modules you want to use.
Above two steps please refer to my previous case:pyodbc on Azure
Hope it helps you.
Upvotes: 2