Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts
Saturday, December 14, 2013

Creating DJango application with Python in Visual Studio

In previous post I have written about creating a basic python application with visual studio. In this post we are going to learn how we can create a DJango application with Python in Visual Studio with the help of python tools for Visual Studio.

What is DJango?


As per wikipedia, DJango is a free open source web application framework written in python which follow ups model view controller architectural pattern.It is maintained by  DJango Software Foundation an independent non profit organization. Django’s primary goal is to ease the creation of complex, database driven websites. DJango emphasizes reusability and plugability   of component and principle of Don’t repeat your self.

Creating DJango application with Visual Studio :


Let’s create first DJango application with Visual Studio and Python tools for Visual Studio. So to create DJango application with we have to create a new project via File->New Project –> DJango project just like following.

first-django-application-with-python-visual-studio

Once you click ok it will create a DJango project like following.

First-Django-application-solution-exploer-visual-studio

Now it’s time to create our first application. So right click FirstDjango folder and add new DJango App.

First-Django-app-solution-explorer-visual-studio

Now once you click on DJango app it will open a box like below.

Add-DJango-app-web-python-visual-studio

Now its time to install Python Environment to application via right click on python environment in solution explorer and select environment.

Select-Python-DJango-Environment-Visual-Studio

Now once you click OK it will add python environment to application.

python-environment-visual-studio

Now right click python 2.7 and right click it will open up a popup like below.

Install-Python-Package-Visual-Studio

Once you click on Install Python Package it will open up a dialog like following.

Install-DJango-VisualStudio
Once you click OK It will install DJango package in Visual Studio after installing lot of files it may take 5 to 10 minutes.

Installing-Django-Visual-Studio-Sucessfully

It’s done!! run your first application with DJango with f5 and following you see in browser.

Running-DJango-Application-Python-Visual-Studio

Woohoo!! your first python web application ready. Hope you like it. Stay tuned for more..
Share:
Wednesday, December 11, 2013

Creating first python application in Visual Studio

Before some time I have blogged about Python tools in Visual Studio and explained how we install python tools with visual studio and start developing python application with the one of greatest editor in class Visual Studio. In this post we are going to learn how we can create a python application in Visual Studio.

First check whether Python Interpreters are install on your machine or not?


First step for creating python application with Visual Studio is to check whether Python interpreters are installed or not not. To Check this after installing Python tools for Visual Studio go to Tools menu –> Python Environments and it will show a list of python environments available.

Python Enviroments for Visual Studio

If it is not installed, you need to download from http://www.python.org/. I have already installed Python 3.3 so its showing there.

Creating first python application:


Once you install Python tools for visual studio it will also have options to create python application in visual studio. So go to file menu –> new project options->templates-> Select python it will show all the python options available for visual studio just like below.

Visual Studio Python Project Templates

There you have few options like below.
  • From Existing Python Code
  • Python Application
  • Django Project
  • Python MPI Application
  • IronPython Application
  • IronPython WPF application
  • IronPython Silverlight Web page
  • IronPython Windows application
As we need to create a simple application for python we are going to our first application with Python application.Once create project it will create application like following.

Python application in visual studio solution explorer

Now open that PythonApplication1.Py and write following code.

Python Hello World application with Visual Studio

And now run application via pressing f5.

PythonApplicationfromvisualStudioOutput

That’s it we are able to run our first application in Visual Studio. Woohoo!! Hope you like it. Stay tuned for more..
Share:
Sunday, December 8, 2013

Python tools for Visual Studio

Lots of people complaining that Microsoft does not support open source that is a myth about Microsoft it does support there are lots of open source initiative done by Microsoft and Python tools for Visual Studio is one of them.

With the help of this plugin you are able to do work on python on Visual Studio one of best editor in class.

Here is the link from you can download the Python tools for Visual Studio. Python tools are available for Visual Studio 2010,2012 and 2013. You can download the tools according your version.

PythonToolsForVisualStudioCodePlex

Go to download and here you can download Python as per your visual studio version 2010,2012 or 2013.

Pythontoolsfordiffrentvisualstudioversion

Installing Python Tools for Visual Studio :


Installation of Python tools is quite easy. Download the setup files and run exe of for that setup. You will get following screen.

PythonForVisualStudioInstallation1

Accept terms in License Agreement and click on install. There is also advance mode available where you can select different options.

PythonForVisualStudioInstallation2

Once you click install it will start installing python tools.

PythonForVisualStudioInstallation3

Once installation complete it will notify like below.

PythonForVisualStudioInstallation4

Click on finish and Yep you are ready to write code in python for Visual Studio.

Python and Visual Studio :


Now once you open Visual Studio and create a new project it will also Python as new language options.

VisualStudioPythonProject

Here you have various like From Existing Application, Python Application, DJango Project, Python MPI application. You can also see there is IronPython support is also there.

That’s it. You can see its very easy. Hope you like it. Stay tuned for more..
Share:

Support this blog-Buy me a coffee

Buy me a coffeeBuy me a coffee
Search This Blog
Subscribe to my blog

  

My Mvp Profile
Follow us on facebook
Blog Archive
Total Pageviews