Getting Django started
Table of Contents
1. Install Python:
2. Install Django:
Check if you have pip
install
$ pip3 install Django
Check the version:
$ python3 -m django --version
3. Create new project:
$ django-admin startproject project-name
4. Run the project:
cd into Project
$ cd mysite
$ python3 manage.py runserver
Now’s a good time to note: don’t use this server in anything resembling a production environment. It’s intended only for use while developing. (We’re in the business of making web frameworks, not web servers.)
5. Change the ip:port:
$ python3 manage.py runserver 0.0.0.0:8080
6. Project VS App
Project | App |
---|---|
Project is collection of apps | App is single module inside a project |
7. Create app inside a project:
$ cd mysite
$ mysite/ : python3 manage.py startapp polls