Skip to content
Luke Chen edited this page May 21, 2021 · 28 revisions

Installation

https://www.djangoproject.com/download/

$ pip install Django==3.1.7
$ python
Python 3.8.5 (default, Sep  4 2020, 07:30:14) 
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> print(django.get_version())
3.1.7

Upgrade to the latest

$ python -m pip install -U Django
$ python -m django --version
3.2.3

Getting started

https://www.djangoproject.com/start/

Tutorial

https://docs.djangoproject.com/en/3.2/intro/tutorial01/

Setup

To create a site

$ pwd
/home/lchen154/workspace/django
$ django-admin startproject mypoll

To run tests

$ python -Wa manage.py test

To run server

# to listen on default port 8000
python manage.py runserver

# to listen on a specific port
python manage.py runserver 8899

# to listen on all available public IPs
python manage.py runserver 0:8899

To run server with port

python manage.py runserver 8899

Clone this wiki locally