From Network Security Wiki
Revision as of 20:30, 12 December 2018 by Amanjosan2008 (talk | contribs)
Jump to navigation Jump to search



sudo pip3 install django

Check installed version:

python3 -m django --version

Creating a project

cd  /home/mycode (Do not put code under /var/www)
django-admin startproject mysite 

Avoid using names like django (conflict with Django itself) or test (conflicts with a built-in Python package)

Startproject command will create:


These files are:

  • The outer mysite/: Just a container for the project. It can be renamed it to anything.
  • Command-line utility that allows to interact with this Django project in various ways.
  • The inner mysite/ directory is the actual Python package for the project. This is the Python package name to use to import anything inside it (e.g. mysite.urls).
  • mysite/ Empty file that tells Python that this directory should be considered a Python package.
  • mysite/ Settings/configuration for this Django project.
  • mysite/ The URL declarations for this Django project; a “table of contents” of your Django-powered site.
  • mysite/ An entry-point for WSGI-compatible web servers to serve your project.