1

I've made a simple app with Django in Visual Studio 2017, utilizing the default template in Visual Studio (file - new - project - python - django web application). The app runs properly locally, but after i deploy it to Azure via Visual Studio, i can only access the page that shows:

Your App Service app has been created.

The files are all properly uploaded (i can see them in the 'site\wwwroot' folder), but the app doesn't work!

I have tried every thing that i was able to find in my searches such as: following this tutorial; adding '.azurewebsites.net' to the allowed hosts, installing azure sdk in my project virtual environment via: 'pip install azure', adding 'manage.py' to default documents, among many other things.

The thing is when i deploy (in the exact same way: right click the project, select publish, azure...) my ASP.NET apps to Azure, they work properly with minimum effort.

I am very frustated, because i really like Django framework and Azure, please help.

Thanks in advance!

gunslinger
  • 118
  • 10

2 Answers2

0

In consideration of using Visual Studio to create & deploy a Django App for Azure, I suggest that you can follow the Azure offical tutorial Django and MySQL on Azure with Python Tools 2.2 for Visual Studio to inspect & make sure your steps correctly.

There are some checkpoints as below.

  1. Make sure PTVS installed correctly, please move to here to know more details of PTVS.
  2. Create a virtual environment for a Python version like 2.7 via PTVS.
  3. Edit the requirements.txt file of your project, and make sure there is a record for Django like Django==1.11.2.
  4. When you want to deploy it to Azure WebApps, please check the Python version for Azure WebApps that is the same with your project.
  5. If your Django App doesn't still work as you want, please refer to the document to check the configuration of the web.config file via access the Kudu tool https://<your app name>.scm.azurewebsites.net and other troubleshooting content, and refer to the document to check the application settings on Azure portal.

Hope it helps. Any concern, please feel free to let me know.

Peter Pan
  • 23,476
  • 4
  • 25
  • 43
  • Thanks for the answer man, but those tutorials and documents won't work with VS 2017, or at least i wasn't able to do it. I wil refer to you the one that helped me a lot: https://blogs.msdn.microsoft.com/pythonengineering/2016/08/04/upgrading-python-on-azure-app-service/ – gunslinger Jun 05 '17 at 19:12
0

After much struggle i manage to to do it!

I will explain how i did it (i've used many tutorials and forum posts answers to achieve this):

1) I've created a Django (PTVS) Web App in Azure;

2) Followed this tutorial to configure that app;

3) Make the necessary adjustments to web.config file in my project, notably the path to the python version installed via extension;

4) Published my project via Visual Studio 2017 to that Django App created in the first step.

And it worked!

gunslinger
  • 118
  • 10