DJango Installation Steps

DJango Installation Steps

Windows Installation Process

Linux/Ubuntu Installation Process

Install Conda  

Open Anaconda Powershell Prompt

      

Type the below commands in Anaconda Powershell Prompt

  • conda update -n base -c defaults conda
  • conda create –name py1
  • conda init bash ( Only for Linux / Ubuntu Users )
  • conda activate py1
  • conda install mysqlclient
  • conda install django==2.2
  • conda install sqlparse

Install MAMP

  • Startservers and ensure mysql and apache are coming in the green color
  • Click on “Open Web Start Page “

  • Find ‘phpMyAdmin link’
  • Click on the database section – and create one database named -myproject ( use encryption utf8_general_ci )

Install Visual Studio Code  (for editing the code) And install python extension https://code.visualstudio.com/Download

Create Django Project

  • In Document Folder create one folder name ‘projects’
  • cd to that folder from conda shell
  • django-admin startproject wordcount # it will create one folder name as wordcount.
  • Open wordcount/wordcount/settings.py file and change existing DATABASES to as shown below
    • DATABASES = {

    ‘default’: {

        ‘ENGINE’: ‘django.db.backends.mysql’,

        ‘NAME’: ‘myproject’,

        ‘USER’ : ‘root’,

        ‘PASSWORD’ : ‘abcd1234’,

        ‘HOST’ : ‘localhost’,

        ‘PORT’ :”

    }

}

  • And run 
    • Python manage.py runserver    ( it will start the server ) 
    • In IE go to http://127.0.0.1:8000 – if you see django page meaning you have done the setup correctly.

 

Linux/Ubuntu Installation Process

Download the anaconda(Python 3.7) from https://www.anaconda.com/distribution/

Open the terminal and type the below commands:

Mysql Installation:

  • sudo apt-get update
  • sudo apt-get install mysql-server
  • sudo cat /etc/mysql/debian.cnf

Copy the user and password and login to the mysql

  • mysql -h localhost -u username -pPassword

If you see the above prompt then your successfully logged into the mysql

  • create database myproject;