安裝Django
下載Django包,解壓縮。
CMD 進入解壓路徑下。
執行:python setup.py install
增加環境變量:
C:\Python27\Scripts
測試django是否安裝成功
shell
import django
django.VERSION
把Django導入項目
CMD 進入項目路徑
執行 django-admin.py startproject 項目名
運行開發服務器
項目Django路徑下 python manage.py runserver
或
python manage.py runserver 8000
或
通過指定一個 IP 地址,你可以告訴服務器–允許非本地連接訪問。 如果你想和其他開發人員共享同一開發站點的話,該功能特別有用。 `` 0.0.0.0`` 這個 IP 地址,告訴服務器去偵聽任意的網絡接口。
python manage.py runserver 0.0.0.0:8000
以上是在cmd終端運行的django服務器端接下來要在pycharm上運行服務器端:
要是直接運行manage.py程序的話 會提示一大堆東西,那無非是提示沒有傳入參數。所以在pycharm上傳入參數運行即可:操作方式如下
打開manage.py文件 在pycharm右上角點擊edit configurations 編輯配置參數


點開之后彈出如下對話框,在scrip parameters 對應的對話框中輸入配置參數 runserver 0.0.0.0:8000.配置完成之后點擊ok就完成了。


配置完以上信息之后,直接按Ctrl+shift+F10 運行一下manage.py文件:出現如下結果
D:\Python27\python.exe D:/Djangotext01/manage.py runserver 0.0.0.0:8000
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
July 26, 2015 - 22:10:52
Django version 1.8.2, using settings 'Djangotext01.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
D:\Python27\lib\site-packages\django-1.8.2-py2.7.egg\django\utils\translation\__init__.py:146: RemovedInDjango19Warning: The use of the language code 'zh-cn' is deprecated. Please use the 'zh-hans' translation instead.
return _trans.activate(language)
Performing system checks...
System check identified no issues (0 silenced).
You have unapplied migrations; your app may not work properly until they are applied.
Run 'python manage.py migrate' to apply them.
July 26, 2015 - 22:10:52
Django version 1.8.2, using settings 'Djangotext01.settings'
Starting development server at http://0.0.0.0:8000/
Quit the server with CTRL-BREAK.
D:\Python27\lib\site-packages\django-1.8.2-py2.7.egg\django\utils\translation\__init__.py:146: RemovedInDjango19Warning: The use of the language code 'zh-cn' is deprecated. Please use the 'zh-hans' translation instead.
return _trans.activate(language)
配置完成,之后今后啟動的話都會默認為上述配置參數。配置完以上信息之后,在瀏覽器中輸入
http://127.0.0.1:8000 返回如下結果:


備注:
在setting配置中的加入:參數
ALLOWED_HOSTS=['192.168.2.52']