DJango Installation Steps

Name of Innovation

DJango Installation Steps

September 24, 2019 Uncategorized 0

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 -n myenv python=3.9
  • conda init bash ( Only for Linux / Ubuntu Users )
  • conda activate myenv
  • conda install mysqlclient #for Ubuntu
  • pip install mysqlclient #for Windows
  • conda config --append channels conda-forge
  • conda install django==4.0.1 
  • 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' : '127.0.0.1',

        '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;