[Fixed]-How to Install Django with command sudo

1πŸ‘

To install Django on CentOS system, you have to process like that :

Step 1 : Update your system

sudo yum install epel-release
sudo yum update -y && sudo reboot

Step 2 : Install pip and dependencies

sudo yum install python-devel python-setuptools python-pip
sudo pip install --upgrade pip

Step 3 : Install virtualenv and Django inside

sudo pip install virtualenv
source ~/djangoenv/bin/activate

You will obtain something like :

(djangoenv) [user@hostname ~]$

Step 4 : Install Django

pip install django
#or particular version X.X
pip install django==X.X

Step 5 : Create your project

cd ~
django-admin startproject myproject

Step 6 : Runserver

cd myproject/
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver 
πŸ‘€Essex

0πŸ‘

The error is that your username sv is not in the sudo user list. You should ask you sysadmin to add that user to sudo user list. or you can try this
usermod command like usermod -aG groupname username. Refer this (https://www.digitalocean.com/community/tutorials/how-to-create-a-sudo-user-on-centos-quickstart)

You should try a different strategy to install. Two useful links are as follows:

  1. https://www.digitalocean.com/community/tutorials/how-to-install-the-django-web-framework-on-centos-7

  2. https://www.vultr.com/docs/how-to-install-django-on-centos-7

πŸ‘€Harshit Garg

0πŸ‘

Use yum package manager to download and install Django (although it recommended to work in env):

sudo yum install python-django

Test the installation:

django-admin --version

Leave a comment