首页 \ 问答 \ ps教程视频全集入门教程?

ps教程视频全集入门教程?

ps教程视频全集入门教程?
更新时间:2022-05-20 15:05

最满意答案

正常,这才是服务器
首先确保装了Python,我装的是2.x版本,对了,我的操作系统是WIN7,其实对于Python来说,什么操作系统并不重要。Python内置了一个简单的HTTP服务器,只需要在命令行下面敲一行命令,一个HTTP服务器就起来了:
python -m SimpleHTTPServer 80

后面的80端口是可选的,不填会采用缺省端口8000。注意,这会将当前所在的文件夹设置为默认的Web目录,试着在浏览器敲入本机地址:

如果当前文件夹有index.html文件,会默认显示该文件,否则,会以文件列表的形式显示目录下所有文件。这样已经实现了最基本的文件分享的目的,你可以做成一个脚本,再建立一个快捷方式,就可以很方便的启动文件分享了。如果有更多需求,完全可以根据自己需要定制,具体的请参见官方文档SimpleHTTPServer,或者直接看源码。我拷贝一段,方便参考:
import SimpleHTTPServer
import SocketServer

PORT = 8000

Handler = SimpleHTTPServer.SimpleHTTPRequestHandler

httpd = SocketServer.TCPServer(("", PORT), Handler)

print "serving at port", PORT
httpd.serve_forever()

如果你想改变端口号,你可以使用如下的命令: 

python -m SimpleHTTPServer 8080 

如果你只想让这个HTTP服务器服务于本地环境,那么,你需要定制一下你的Python的程序,下面是一个示例: 

import sys 
import BaseHTTPServer 
from SimpleHTTPServer import SimpleHTTPRequestHandler 
HandlerClass = SimpleHTTPRequestHandler 
ServerClass = BaseHTTPServer.HTTPServer 
Protocol = "HTTP/1.0"

if sys.argv[1:]:
port = int(sys.argv[1]) 
else:
port = 8000 
server_address = ('127.0.0.1', port)

HandlerClass.protocol_version = Protocol 
httpd = ServerClass(server_address, HandlerClass)

sa = httpd.socket.getsockname() 
print "Serving HTTP on", sa[0], "port", sa[1], "..." 
httpd.serve_forever() 

注意:所有的这些东西都可以在 Windows 或 Cygwin 下工作。
您可能感兴趣的文章:

相关问答

更多
  • 启动WIN server,用管理员帐号登录并确保已安装活动目录,如未安装活动目录先行安装;查看该服务器IP地址和子网掩码; 单击”开始”-”程序”-”管理工具”-”DHCP”,按如下要求配置DHCP服务器; (1) 地址池:192.168.12.100至192.168.12.254,(2) 排除地址192.168.12.200至192.168.12.220;子网掩码为255.255.0.0; (3) 地址租约:1天; (4) 网关/路由器地址:192.168.0.2 ; (5) DNS服(6) 务器地址:2 ...
  • 我的世界服务器创建教程 教你如何建立服务器 我的世界服务器名字与主题 开服之初可以根据自己的喜好选择服务器的主题与名字,因为毕竟我的世界服务器还是你(服主)的世界,所以一开始的主题选择,关系到以后玩家在你服务器里面的玩法,建筑风格管理模式,如果你喜欢建造,可能你就不希望看到服务器里面刷怪塔林立。如果你喜欢坚持minecraft探险模式,你可能就要考虑出生点规划,玩家安全等等的事情。 我的世界建筑跟探险是主要的两种模式,建筑更容易产生很漂亮的观光服务器,探险游戏性更大,后期可以加入经济系统等等,但是因为怪的存 ...
  • 比如微软的exchange,但要在域环境下才可以,配置相对复杂点;winmail相对简单些,以上是windows环境下的。linux下邮件系统有sendmail,postfix等
  • 正常,这才是服务器 首先确保装了Python,我装的是2.x版本,对了,我的操作系统是WIN7,其实对于Python来说,什么操作系统并不重要。Python内置了一个简单的HTTP服务器,只需要在命令行下面敲一行命令,一个HTTP服务器就起来了: python -m SimpleHTTPServer 80 后面的80端口是可选的,不填会采用缺省端口8000。注意,这会将当前所在的文件夹设置为默认的Web目录,试着在浏览器敲入本机地址: 如果当前文件夹有index.html文件,会默认显示该文件,否则,会以文 ...
  • 1.首先要打开nfs和smb服务:   打开终端,root权限登陆,输入命令:setup   选择nfs和smb项,去掉iptables项(防火墙),按空格键可选择或去掉服务项   2.启动nfs和smb服务:   输入命令:   service nfs restart   service smb restart   3.建立或选择一个smb用户,这样就可以把一个linux下的用户目录共享给windows:   输入命令:   smbpasswd -a calvin   提示要求输入密码:New SMB p ...
  • 如果您读取源代码,您将看到只有端口可以在命令行上被覆盖。 如果要更改其所提供的主机,您将需要自己实现SimpleHTTPServer和BaseHTTPServer的test()方法。 但这应该很简单。 这可以很容易地做到这一点: import sys from SimpleHTTPServer import SimpleHTTPRequestHandler import BaseHTTPServer def test(HandlerClass=SimpleHTTPRequestHandler, ...
  • 从堆栈溢出问题什么是Python 3相当于“python -m SimpleHTTPServer” : 以下为我工作: python -m http.server [] 因为我使用Python 3 ,至少在Windows中, SimpleHTTPServer模块已被http.server替代。 From Stack Overflow question What is the Python 3 equivalent of "python -m SimpleHTTPServer": The f ...
  • 使用os.chdir更改当前目录,然后按照通常的方式启动服务器。 Use os.chdir to change the current directory then follow as you normally would to start the server.
  • 否。如果客户端Connection refused ,则表示连接请求未到达服务器应用程序。 因此,服务器应用程序不可能注册这些错误。 检查防火墙,路由,连接以及服务器地址和端口的正确性。 No. If the client gets a Connection refused, this means that the connection request did not reach the server application. Therefore, the server application cannot ...
  • 如果您在命令行中没有看到任何内容,则服务器无法获得任何输入。 您必须在该端口上侦听其他进程。 尝试使用其他端口以确保: python -m SimpleHTTPServer 12345 只是一个提示,要检查哪些应用程序在哪个端口上监听, netstat命令可能非常有用:) 希望这可以帮助! If you aren't seeing anything on the command line, then the server is not getting any input. You must have so ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。