Installing Django 2.0 CentOS

Django is an open-source framework written in python for quickly building web applications. Django includes user authentication, content management, sites maps, and several other features by default to make it easier and faster for developers to build their applications. In this article, we will show you how to install a Django.

Installing Django on CentOS

  1. First you will need the EPEL repository to install the necessary packages.
    sudo yum install epel-release
    sudo yum update -y
  2. Then you need to install some python packages.
    sudo yum install python-devel python-setuptools python-pip
    pip install mysql-python virtualenv
  3. Next you need to create a virtual environment for your project, The purpose of this is to isolate the packages used by this project to prevent any other packages installed for other projects from causing conflicts.
    cd ~
    virtualenv django1
  4. Now enter the virtual environment and install django.
    source ~/django1/bin/activate
    pip install django
  5. Now that you have Django installed you can create your project.
    django-admin startproject project1

    Now that you have created the project run the commands below and follow the prompts to create your admin user for the Django dashboard.

    python manage.py migrate
    python manage.py createsuperuser
    python manage.py runserver 0.0.0.0:8000
    

    You should now be able to go to https://<yourIP>:8000 and you should see a page saying “It Worked, Congratulations on your first Django-powered page”. You can view your dashboard going to https://<yourIP>:8000/admin and logging in with the credentials created before.

Congratulations! You now have Django installed.

Was this article helpful? Join the conversation!

Server Madness Sale
Score Big with Savings up to 99% Off

X