python脚本设置运行参数
来源:互联网 发布:js replace 单引号 编辑:程序博客网 时间:2024/05/29 13:25
正在学习Django框架,在运行manage.py的时候需要给它设置要监听的端口,就是给这个脚本一个运行参数。教学视频中,是在Eclipse中设置的运行参数,网上Django大部分都是在命令行中运行manage.py时添加参数,没有涉及到如何在pycharm中设置运行参数。以下是两种设置运行参数的方法(以manage.py为例),不设置运行参数时,运行结果为
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 runserverProcess finished with exit code 0
没有显示监听端口,因为它本身缺少参数
1、常用的命令行设置参数的方法
D:\Django project\DjangoProject1>python manage.py runserver 0.0.0.0:8000在manage.py脚本的根目录下运行cmd,输入python manage.py + 参数,以下是运行结果
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成功监听到了8000端口
2、在pycharm中设置运行参数
run --> Edit Configurations -->Scrip parameters
设置好之后运行
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.
成功监听8000端口。
0 0
- python脚本设置运行参数
- python运行脚本参数-m
- Python 运行脚本时传递参数
- 设置linux开机自动运行Python脚本
- Python:定时运行脚本
- Python 定时运行脚本
- 如何运行Python脚本
- Python批量运行脚本
- Python定时运行脚本
- python 后台运行脚本
- Python脚本运行问题
- 运行python脚本
- python脚本后台运行
- Python:脚本参数传递
- 【Python】读取命令行参数、在PyDev中设置Python运行时的参数
- eclipse设置运行参数
- PyCharm 设置运行参数
- PyCharm 设置运行参数
- linux awk
- 程序员之素养《高质量C++/C编程指南》(一)
- Java Hashmap多线程同时操作导致的问题
- golang 语言学习
- 华为上机题之坐标移动
- python脚本设置运行参数
- 各种接口测试、jmeter、LRunner、selenium等视频分享
- IOS开发第二天-协议与委托
- hadoop实例(java模板):数字逆序输出 (自定义mapper,reducer,自定义key2类型,重写compareTo函数,HDFS操作)
- 框架的API设计
- 文本分析--jieba中文分词
- 个人Android学习路线 (Android职业规划)
- CMD网络命令
- layui-js/css