**Initial Setup**
Install Python 3
Download and check on the terminal.
1 | $ python --version |
If it works, then done.
Virtual Environment
Virtual environment enables multiple projects works on the same computer.
To install pipenv, use command below.
1 | $ pip3 install pipenv |
Install Django
To see pipenv works, first we install django.
Create a directory named django.
1 | $ cd ~/desktop |
Now use Pipenv to install Django.
1 | $ pipenv install django==2.1 |
Then there will be two more files Pipfile
and Pipfile.lock
.
Run command line below to activate the virtual environment.
1 | $ pipenv shell |
The following command is to test whether it works. (Remember there is a dot .
in the end. This is to reduce redundancy.)
1 | (django) $ django-admin startproject test_project . |
Now we can confirm everything is working by running Django’s local web server.
1 | (django) $ python manage.py runserver |
If you visit http://127.0.0.1:8000/ you should see the Django welcome page.
To stop the local server, using Ctrl + C
or exit
.
To reactivate pipenv, using pipenv shell
, to exit using exit
.
Install Git
Download it on the website, and then follow the steps to install it.
One thing is that you need to asscoiate with you email address and name. Use command line below.
1 | $ git config --global user.name "Your Name" |
To see more details, you can use this book as a reference.
Django for beginners
The first three chapters are free.
啊,写这个还挺累的啊。。。不过就当做笔记了。。。。