国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Python > 正文

淺談python腳本設(shè)置運(yùn)行參數(shù)的方法

2020-01-04 13:56:33
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

正在學(xué)習(xí)Django框架,在運(yùn)行manage.py的時(shí)候需要給它設(shè)置要監(jiān)聽(tīng)的端口,就是給這個(gè)腳本一個(gè)運(yùn)行參數(shù)。教學(xué)視頻中,是在Eclipse中設(shè)置的運(yùn)行參數(shù),網(wǎng)上Django大部分都是在命令行中運(yùn)行manage.py時(shí)添加參數(shù),沒(méi)有涉及到如何在pycharm中設(shè)置運(yùn)行參數(shù)。以下是兩種設(shè)置運(yùn)行參數(shù)的方法(以manage.py為例),不設(shè)置運(yùn)行參數(shù)時(shí),運(yùn)行結(jié)果為

D:/Python2.7/python.exe "D:/Django project/DjangoProject1/manage.py" Type 'manage.py help <subcommand>' for help on a specific subcommand. Available subcommands: [auth] changepassword createsuperuser [django] check compilemessages createcachetable dbshell diffsettings dumpdata flush inspectdb loaddata makemessages makemigrations migrate sendtestemail shell showmigrations sqlflush sqlmigrate sqlsequencereset squashmigrations startapp startproject test testserver [sessions] clearsessions [staticfiles] collectstatic findstatic runserver Process finished with exit code 0

沒(méi)有顯示監(jiān)聽(tīng)端口,因?yàn)樗旧砣鄙賲?shù)

1、常用的命令行設(shè)置參數(shù)的方法

D:/Django project/DjangoProject1>python manage.py runserver 0.0.0.0:8000

在manage.py腳本的根目錄下運(yùn)行cmd,輸入python manage.py + 參數(shù),以下是運(yùn)行結(jié)果

Performing system checks... System check identified no issues (0 silenced). You have 13 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.April 11, 2017 - 13:26:13Django version 1.10.6, using settings 'DjangoProject1.settings'Starting development server at http://0.0.0.0:8000/Quit the server with CTRL-BREAK.[11/Apr/2017 13:27:16] "GET / HTTP/1.1" 200 1767Not Found: /favicon.ico[11/Apr/2017 13:27:16] "GET /favicon.ico HTTP/1.1" 404 1944Not Found: /favicon.ico[11/Apr/2017 13:27:16] "GET /favicon.ico HTTP/1.1" 404 1944

成功監(jiān)聽(tīng)到了8000端口

2、在pycharm中設(shè)置運(yùn)行參數(shù)

run --> Edit Configurations -->Scrip parameters

python,腳本,運(yùn)行參數(shù)

python,腳本,運(yùn)行參數(shù)

設(shè)置好之后運(yùn)行

D:/Python2.7/python.exe "D:/Django project/DjangoProject1/manage.py" runserver 0.0.0.0:8000Performing system checks... System check identified no issues (0 silenced). You have 13 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.April 11, 2017 - 14:07:30Django version 1.10.6, using settings 'DjangoProject1.settings'Starting development server at http://0.0.0.0:8000/Quit the server with CTRL-BREAK.

成功監(jiān)聽(tīng)8000端口。

以上這篇淺談python腳本設(shè)置運(yùn)行參數(shù)的方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持VEVB武林網(wǎng)。


注:相關(guān)教程知識(shí)閱讀請(qǐng)移步到python教程頻道。
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 岳西县| 鸡东县| 普宁市| 西乡县| 武义县| 平顶山市| 上杭县| 安徽省| 潞西市| 隆化县| 竹北市| 忻城县| 巴东县| 阿荣旗| 大邑县| 木兰县| 丘北县| 临洮县| 和顺县| 金门县| 毕节市| 安顺市| 乾安县| 山阳县| 延长县| 牙克石市| 柘荣县| 饶河县| 广宗县| 许昌市| 许昌县| 武威市| 互助| 新河县| 故城县| 安阳县| 澄江县| 怀仁县| 泰兴市| 子长县| 新乡县|