Python3.8安裝配置Django環(huán)境(上)

Python3.8安裝配置Django環(huán)境(上)

【本節(jié)知識點】:
       配置開發(fā)環(huán)境:Python3.8 + Django
       查看Python版本
       安裝django又沾、查看版本
       安裝pymysql
       新建django項目
       測試django服務器

1、CMD查看python版本

C:\Users\Administrator>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

2汰寓、CMD查看pip版本

C:\Users\Administrator>pip

Usage:
  pip <command> [options]

Commands:
  install                     Install packages.
  download                    Download packages.
  uninstall                   Uninstall packages.
  freeze                      Output installed packages in requirements format.
  list                        List installed packages.
  show                        Show information about installed packages.
  check                       Verify installed packages have compatible dependencies.
  config                      Manage local and global configuration.
  search                      Search PyPI for packages.
  wheel                       Build wheels from your requirements.
  hash                        Compute hashes of package archives.
  completion                  A helper command used for command completion.
  debug                       Show information useful for debugging.
  help                        Show help for commands.

General Options:
  -h, --help                  Show help.
  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.
  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.
  -V, --version               Show version and exit.
  -q, --quiet                 Give less output. Option is additive, and can be used up to 3 times (corresponding to
                              WARNING, ERROR, and CRITICAL logging levels).
  --log <path>                Path to a verbose appending log.
  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.
  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).
  --timeout <sec>             Set the socket timeout (default 15 seconds).
  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup,
                              (a)bort.
  --trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.
  --cert <path>               Path to alternate CA bundle.
  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the
                              certificate in PEM format.
  --cache-dir <dir>           Store the cache data in <dir>.
  --no-cache-dir              Disable the cache.
  --disable-pip-version-check
                              Don't periodically check PyPI to determine whether a new version of pip is available for
                              download. Implied with --no-index.
  --no-color                  Suppress colored output

C:\Users\Administrator>Python3.8安裝配置Djan

3雕什、pip 安裝Django缠俺,默認Django3

C:\Users\Administrator>pip install django
Collecting django
  Using cached https://files.pythonhosted.org/packages/12/68/8c125da33aaf0942add5095a7a2a8e064b3812d598e9fb5aca9957872d71/Django-3.0.4-py3-none-any.whl
Collecting sqlparse>=0.2.2 (from django)
  Using cached https://files.pythonhosted.org/packages/85/ee/6e821932f413a5c4b76be9c5936e313e4fc626b33f16e027866e1d60f588/sqlparse-0.3.1-py2.py3-none-any.whl
Collecting asgiref~=3.2 (from django)
  Using cached https://files.pythonhosted.org/packages/68/00/25013f7310a56d17e1ab6fd885d5c1f216b7123b550d295c93f8e29d372a/asgiref-3.2.7-py2.py3-none-any.whl
Collecting pytz (from django)
  Using cached https://files.pythonhosted.org/packages/e7/f9/f0b53f88060247251bf481fa6ea62cd0d25bf1b11a87888e53ce5b7c8ad2/pytz-2019.3-py2.py3-none-any.whl
Installing collected packages: sqlparse, asgiref, pytz, django
Successfully installed asgiref-3.2.7 django-3.0.4 pytz-2019.3 sqlparse-0.3.1
WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

升級pip

python -m pip install --upgrade pip

4、查看Django版本

C:\Users\Administrator>python
Python 3.8.1 (tags/v3.8.1:1b293b6, Dec 18 2019, 23:11:46) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> django.VERSION
(3, 0, 4, 'final', 0)
>>>

5贷岸、安裝mysql

pip install pymysql

6壹士、查看mysql版本

7、建立Django文件夾并進入偿警,

C:\Users\Administrator>mkdir django

C:\Users\Administrator>cd django

8躏救、開始一個django項目

C:\Users\Administrator\django>django-admin.py startproject hellodjango

C:\Users\Administrator\django>cd hellodjango

C:\Users\Administrator\django\hellodjango>dir
 驅動器 C 中的卷沒有標簽。
 卷的序列號是 BA47-1B36

 C:\Users\Administrator\django\hellodjango 的目錄

2020-03-27  15:51    <DIR>          .
2020-03-27  15:51    <DIR>          ..
2020-03-27  15:51    <DIR>          hellodjango
2020-03-27  15:51               652 manage.py
               1 個文件            652 字節(jié)
               3 個目錄 45,728,935,936 可用字節(jié)

9、運行服務器盒使,測試Django項目

C:\Users\Administrator\django\hellodjango>manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
March 27, 2020 - 15:51:31
Django version 3.0.4, using settings 'hellodjango.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

10崩掘、使用地址訪問http://127.0.0.1:8000/Django項目

![Django.jpg](https://upload-images.jianshu.io/upload_images/7506896-5b4cf58aca9036a0.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)

[27/Mar/2020 15:51:39] "GET / HTTP/1.1" 200 16351
[27/Mar/2020 15:51:40] "GET /static/admin/css/fonts.css HTTP/1.1" 200 423
Not Found: /favicon.ico
[27/Mar/2020 15:51:40] "GET /favicon.ico HTTP/1.1" 404 1977
[27/Mar/2020 15:51:40] "GET /static/admin/fonts/Roboto-Light-webfont.woff HTTP/1.1" 200 85692
[27/Mar/2020 15:51:40] "GET /static/admin/fonts/Roboto-Regular-webfont.woff HTTP/1.1" 200 85876
[27/Mar/2020 15:51:40] "GET /static/admin/fonts/Roboto-Bold-webfont.woff HTTP/1.1" 200 86184

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
禁止轉載,如需轉載請通過簡信或評論聯(lián)系作者少办。
  • 序言:七十年代末苞慢,一起剝皮案震驚了整個濱河市,隨后出現(xiàn)的幾起案子凡泣,更是在濱河造成了極大的恐慌枉疼,老刑警劉巖皮假,帶你破解...
    沈念sama閱讀 211,884評論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件鞋拟,死亡現(xiàn)場離奇詭異,居然都是意外死亡惹资,警方通過查閱死者的電腦和手機贺纲,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,347評論 3 385
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來褪测,“玉大人猴誊,你說我怎么就攤上這事∥甏耄” “怎么了懈叹?”我有些...
    開封第一講書人閱讀 157,435評論 0 348
  • 文/不壞的土叔 我叫張陵,是天一觀的道長分扎。 經常有香客問我澄成,道長,這世上最難降的妖魔是什么畏吓? 我笑而不...
    開封第一講書人閱讀 56,509評論 1 284
  • 正文 為了忘掉前任墨状,我火速辦了婚禮,結果婚禮上菲饼,老公的妹妹穿的比我還像新娘肾砂。我一直安慰自己,他們只是感情好宏悦,可當我...
    茶點故事閱讀 65,611評論 6 386
  • 文/花漫 我一把揭開白布镐确。 她就那樣靜靜地躺著,像睡著了一般饼煞。 火紅的嫁衣襯著肌膚如雪源葫。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 49,837評論 1 290
  • 那天派哲,我揣著相機與錄音臼氨,去河邊找鬼。 笑死芭届,一個胖子當著我的面吹牛储矩,可吹牛的內容都是我干的感耙。 我是一名探鬼主播,決...
    沈念sama閱讀 38,987評論 3 408
  • 文/蒼蘭香墨 我猛地睜開眼持隧,長吁一口氣:“原來是場噩夢啊……” “哼即硼!你這毒婦竟也來了?” 一聲冷哼從身側響起屡拨,我...
    開封第一講書人閱讀 37,730評論 0 267
  • 序言:老撾萬榮一對情侶失蹤只酥,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后呀狼,有當地人在樹林里發(fā)現(xiàn)了一具尸體裂允,經...
    沈念sama閱讀 44,194評論 1 303
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 36,525評論 2 327
  • 正文 我和宋清朗相戀三年哥艇,在試婚紗的時候發(fā)現(xiàn)自己被綠了绝编。 大學時的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 38,664評論 1 340
  • 序言:一個原本活蹦亂跳的男人離奇死亡貌踏,死狀恐怖十饥,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情祖乳,我是刑警寧澤逗堵,帶...
    沈念sama閱讀 34,334評論 4 330
  • 正文 年R本政府宣布,位于F島的核電站眷昆,受9級特大地震影響蜒秤,放射性物質發(fā)生泄漏。R本人自食惡果不足惜隙赁,卻給世界環(huán)境...
    茶點故事閱讀 39,944評論 3 313
  • 文/蒙蒙 一垦藏、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧伞访,春花似錦掂骏、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,764評論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至冒黑,卻和暖如春田绑,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背抡爹。 一陣腳步聲響...
    開封第一講書人閱讀 31,997評論 1 266
  • 我被黑心中介騙來泰國打工掩驱, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 46,389評論 2 360
  • 正文 我出身青樓欧穴,卻偏偏與公主長得像民逼,于是被迫代替她去往敵國和親涮帘。 傳聞我的和親對象是個殘疾皇子拼苍,可洞房花燭夜當晚...
    茶點故事閱讀 43,554評論 2 349