在開始之前, 你的系統必須安裝好Python及Django
我的作業系統是Ubuntu, 所以如果你是用Fedoa或其他系統, 你得用其他方式來安裝
My OS is Ubuntu, so if you use Fedora or CentOS, maybe you have to use yum install to do.
Step 1. Install Python 安裝Python
# apt-get install python
Step 2. Install Django 安裝Django
# apt-get install python-django
你可以試著執行python, 然後打入以下語法來測試是否成功安裝Django
Then you can try to see Django version from above command line:
# python
>>> import django
>>> print django.get_version()
1.2.3
Step 3. Creating a project 建立一個新的專案
# django-admin startproject mysite
會產生以下的目錄及檔案
mysite/
__init__.py
manage.py
settings.py
urls.py
Step 4. started the Django development server
# python manage.py runserver
開啟 http://127.0.0.1:8000/ You will see the message above.
Reference:
Quick install guide
Writing your first Django app, part 1