Getting Started with Python development and combat 19-windows Azure deployment 2

Source: Internet
Author: User
Tags virtual environment

19. Microsoft Cloud Deployment 2

In the previous section we described how to implement our Python Django application in the Microsoft cloud via a virtual machine, this chapter describes how to deploy our application in a way that deploys Web sites on Windows Azure, which is more convenient to deploy and more integrated with VS 2013.

19.1. Create a web App

After we log in to the Windows Azure China account, go to the admin portal, select "Web App" and click on the New button, such as:

After the creation is complete, we select Myazure progress to the application's management interface, such as:

Click the "Browse" button to browse the site, if the site creation successful browsing results are as follows:

19.2. Configure the website to support Python version 2.7

We select the "Configuration" menu on the admin screen of the website, configure the Web site to run Python 2.7, and turn off PHP support.

Browse the site again and run the results such as:

19.3. Add the project's mydb.db file to the project

19.4. Modify the project's settings.py file to modify the access address of the database file to a relative path.
 import    Os.path  DATABASES  =  " default   : { #     engine   ": "  django.db.bac Kends.sqlite3   " ,  #   
'NAME': Os.path.join (Os.path.dirname (Os.path.dirname (__file__)), ' mydb.db'). Replace ('\ \', '/')
),        #Not used with sqlite3.        'USER':"',        #Not used with sqlite3.        'PASSWORD':"',        #Set to empty string for localhost. Not used with Sqlite3.        'HOST':"',        #Set to empty string for default. Not used with Sqlite3.        'PORT':"',    }}

19.5. Create a virtual environment for your project

Now that our web site supports the Python runtime, we then deploy our Python Django Project MySite, and first we explicitly label the Django version 1.4 in the project's Requirements.txt file.

django==1.4

Next, in Solution Explorer, we create a virtual runtime environment for the project, right-click the Python environments in the Django project, and choose ADD virtual Environment.

Enter the virtual environment name, such as "env", to create a folder called "Env", which contains the virtual Python environment and the Django 1.4 version, such as:

After you complete the above modifications, run the project in VS2013 to determine if the project is working properly, such as:

19.6. Download the release deployment file to the local

19.7. deploy files to cloud Web Apps

In Solution Explorer, right-click the MySite project and select Publish.

Import the deployment configuration file that we downloaded, such as:

Click "Start Preview" To view the updated files, click on the "Publish" button to deploy the project files.

19.8. Run the Web app and publish successfully

19.9. Summary

Creating and publishing a Windows Azure Web App relative to virtual machine publishing is a lot easier and more convenient if we're going to publish a Python Django app in Windows Azure, we recommend this scenario. In the next chapter we describe how to develop a service number using Python Django.

Getting Started with Python development and combat 19-windows Azure deployment 2

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.