Install Django Framework on windows

After reading this post you can easily install django framework on windows system. for using django you need to install the python because django is a python framework and it relay on python.

Install Python
Install pip
  • Download get-pip.py file: Click Here
    Now place this file on your desktop (Desktop path is just for example, you can place this file anywhere you want in your system.)
  • Go to desktop and right Click on get-pip.py file > Click Change > Click Look for another app on this PC > Go to the python folder C:\Users\justin\AppData\Local\Programs\Python\Python36 installed on your system > select python.exe > Click Open > Click Apply and Save
    Note:Now get-pip.py file will open with python by default.
  • Open command prompt by pressing window key + R and type cmd then press Enter key. Default path displayed in command prompt is your Users folder path (Ex: C:\Users\justin>)
  • You can change the target folder path in command prompt by using following command prompt.

    1. pushd D:\: It takes user to different drive like i have written D:\ so it will redirect to D drive.
    2. cd ..: It takes back user to one level (Ex: if you run this command in default path then it will take you to the Users folder)
    3. cd kuldeep: It takes you to the “justin” folder.
  • Go to Desktop folder in command prompt by writing following command C:\Users\justin> cd desktop and press Enter.
  • Now Install pip by writing following command C:\Users\justin\Desktop>python get-pip.py and press Enter key.
Install Django

Before installing Django we need to Install Virtual environment, Follow the steps below to install virtual environment first.

  • Open Command prompt by typing cmd(You can keep continue using the same session if you already open the command prompt) and then type C:\Users\justin>pip install virtualenv and press Enter.
  • To check the virtualenv version or confirmation of installation process, type C:\Users\justin>pip freeze
  • Now you have to start virtual environment by typing following command, C:Users\justin\Desktop>virtualenv venv
    Note:
    1. You can give any name to the folder rather than venv.
    2. You have to go to the folder where you have to create a virtual environment folder, so you can see above i have moved to Desktop to create the folder.
    3. After running the above command it will create a new folder venv on Desktop.
  • Now go to venv folder by typing following command C:Users\justin\Desktop>cd venv
  • Now Start the Virtual environment by typing following command C:Users\justin\Desktop\venv>.\Scripts\activate, It start the virtual environment as you can see (venv) at the starting of the command line.
    Note:
    1. To deactivate the virtual environment just write deactivate (venv) C|\Users\justin\Desktop\venv>deactivate
    2. To access django you need to keep activate the virtual environment.
  • Now we have to install Django in this virtual environment folder.
    1. write following command to install django in folder: (venv) C:\Users\justin\Desktop\venv>pip install django and press Enter.
      Note:
      1. Above Command will install the latest version of the django.
      2. Install the specific version of the django you have to mention the version just after the django in command line like: (venv) C:\Users\justin\Desktop\venv>pip install django==1.6.5
    2. Write the following command to ensure the installation and version of the django: (venv) C:\Users\justin\Desktop\venv>pip freeze
  • Now start the Project by typing command: (venv) C:\Users\justin\Desktop\venv>python .\Scripts\django-admin.py startproject test_project and press Enter. It will create a folder with name test_project inside the venv folder. You can change the name of the folder as you want later or you can set a different name in command to make the folder with the same name.
    Note: Here i have changed the name of the folder to src but there is another folder name test_project, that i am not going to change.
  • Now go to src folder by typing the following command: (venv) C:\Users\justin\Desktop\venv\>cd src
  • Now start server by sritting the following command: (venv) C:\Users\justin\Desktop\venv\src>python manage.py runserver
    Above Command will run the server and will prompt a message to start the server at http://127.0.0.1:8000/ so just type this in your browser and you will see a welcome screen of django.

You may also like...

1 Response

  1. John says:

    Hey webmaster
    When you write some blogs and share with us,that is a hard work for you but share makes you happly right?
    yes I am a blogger too,and I wanna share with you my method to make some extra cash,not too much
    maybe $100 a day,but when you keep up the work,the cash will come in much and more.more info you can checkout my blog.
    http://bit.ly/makemoneymethod2018
    good luck and cheers!

Leave a Reply

Your email address will not be published.