DJango Installation Steps
Windows Installation Process
Linux/Ubuntu Installation Process
Install Conda
- Site / conda version — https://www.anaconda.com/distribution/
- If Anacando is already installed then remove and install new one
- Download the Python 3.9 version
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
- Download MAMP ( NON PRO Version ) —https://www.mamp.info/en/downloads/
- Open MAMP ( screen )
- 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:
- wget https://repo.anaconda.com/archive/Anaconda3-2019.07-Linux-x86_64.sh
- bash Anaconda3-2019.03-Linux-x86_64.sh
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;