How to configure Python Flask in window?

Flask is the web development light weighted framework.  In order to do this it needs to do some configuration to your machine that is I am going to tell you in this post.

First of all you need to download Python 2.7 from its official website. And install it to your system.

Now you will get the folder named Python 27 in your C drive. Now open it and copy the path and go to your desktop and right click on My computer icon and click on properties.

After that a small window appears and in right bottom you get a button named Environment Variable, click on it.

Now you will get two boxes of System and User respectively. Under the System box click on path variable and Paste then path that you copied it in bigining.

Now open your CMD and go to your Python 27 and Scripts directly by CMD.

scropts

When you are inside it just type the command : pip install flask

And hit enter , it may take 2 or 3 mins depending upon your INTERNET speed.

Now make your project folder in any directory in your system. In my case let say I have created it in E drive and inside it create another folder named app and again inside it make two folder named templates and static respectively.

Now open any text editor any type then simple hello world ! Application code.

flask code

 

Now open again CMD and run the code like this it in same directory as I told above

E>: CD flask

E:>flask > CD app

E:flask>app python  __init__.py

Http://127.0.0.1:5000/ is running on…

Something like this will be shown if everything done file till now. Now open browser and type the same URL and see the result.

Since Python is case sensitive language so make sure you have typed the same code as  above.

If you face any problem regarding configuration or running the code  then you can watch this video.

And if still face any problem then you can comments I will definitely reply soon.

Happy coding !!!!!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s