Create an Django Project/application

Dear Reader, this article is not intended to explain anything about Django but just listing all the command to be executed in order to create a django project and an application. If you are very beginner, Here are some new terms for you like pip and virtual environment.

PipPip is a standard package-management system for packages written in python. It is just like npm for node, apt for linux/ubuntu and used in the same way to install and manage software packages.

Virtual environment (virtualenv): It is a tool used to create an isolated Python environment. When you create a virtualenv, it creates a directory with the name defined at the time of creation of virtualenv. Now, whenever your python project needs a package and you install that package using pip, all the necessary executables files are stored in virtualenv directory.

You can execute these command in the order listed here:

  1. Install pip
    apt install python3-pip
  2. Install virtual environment
    pip3 install virtualenv
  3. Create a directory
    mkdir django-project
    cd django-project
    
  4. Create virtual environment
    Syntax: virtualenv -p <pythonVersion> <virtualEnvironmentName>

    virtualenv -p python3.6 venv_django
  5. Activate virtual environment
    source venv_django/bin/activate
    
  6. Install django
    Make sure that your virtual environment is activated and you are installing django in your virtual environment

    pip install Django
    
  7. Create django project
    python venv_django/bin/django-admin.py startproject core
    

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to Top
Shares