Commands


All the Python and Django commands and their functions

Index List:

  1. Django Help Commands
  2. Starter Commands
  3. Manage.py Commands
  4. Python Commands
  5. Virtual Environment Commands
  6. Anaconda Commands

Django Help Commands

Commands Description
django-admin help to display usage information and a list of the commands provided by each application.
django-admin help [command] to display a list of all available commands.
django-admin help --commands to display a description of the given command and a list of its available options.

Starter Commands

Commands Description
django-admin.py startproject myprojectname Creates a Django Project and auto generates the files needed.
python manage.py startapp blog Creates an application within the project

Manage.py Commands

Commands Description
python manage.py migrate Migrates the changes in the models/forms/etc to the database.
python manage.py makemigratations Migrates the changes in the models/forms/etc to the database.
python manage.py runserver Runs the Server usaully port:8000
python manage.py runserver 8080 Runs the Server on specfic port
python manage.py createsuperuser Creates a Superuser with full permissions.

Python Commands

Commands Description
python --version Starts Python Interpreter
python Starts Python Interpreter
exit() Exits the Python Interpreter
python test.py Runs the test.py file and return result in terminal or actions the file script.
python get-pip.py Installs Pip
pip install -U pip upgrades pip
pip search django The search command allows you to search through the database of packages in Python’s central package repository
pip install [Flask/packagename] Installs packages using pip
pip uninstall [Flask/packagename] Uninstalls packages using pip
pip list Lists all the packages within pip

Virtual Environment Commands

There are two main types of Env you can use in python, pipenv or virtualenv

Commands Description
pip3 install pipenv Installs PipEnv environment
pip3 install virtualenv Installs VirtualENV package
virtualenv [environment-name] Creates a virtual Environment
source [environment-name]/bin/activate Activates Virtual Environment
deactivate Deactivates the Virtual Environment
pipenv install [requests/package] Installs requests package or the package you name using pipenv
pip install [requests/package] Installs requests package or the package you name using virtualenv packge

Anaconda Commands

Commands Description
conda -V Checks the version of Anaconda
conda info --envs display the current environments saved
conda update conda Updates all the packages that come pre installed with Anaconda
conda create -n [yourenvname] python=x.x anaconda Creates a virtual Environment In Anaconda
source activate [yourenvname] Activates your chosen Virtual Environment
conda install -n [yourenvname] [package] Install additional Python packages to a virtual environment.
conda env update –f environment.yml –n your_env_name Update the environment
source deactivate Deactivates the Virtual Environment In Anaconda
conda remove -n yourenvname -all Delete a no longer needed virtual environment