#!/usr/bin/python
import SimpleHTTPServer
import SocketServer
import os PORT = 7777
WEBDIR = "/www/web/xxx_com/" class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def translate_path(self, path):
os.chdir(WEBDIR)
return SimpleHTTPServer.SimpleHTTPRequestHandler.translate_path(self,path) try:
httpd = SocketServer.TCPServer(("", PORT), Handler)
print "dir %s serving at port %s"%(repr(WEBDIR), PORT)
httpd.serve_forever()
except:pass

python快速搭建WebServer的更多相关文章

  1. 使用 python快速搭建http服务

    在 Linux 服务器上或安装了 Python 的机器上,Python自带了一个WEB服务器 SimpleHTTPServer. 我们可以很简单的使用  python -m SimpleHTTPSer ...

  2. python快速搭建http服务

    在Windows 7/10或Ubuntu上可以通过python2.x或python3.x来快速搭建一个简单的HTTP服务器. 如果python为2.x,则可执行:$ python -m SimpleH ...

  3. 用python快速搭建WEB服务器

    cmd下进入你要搞WEB项目的目录 输入↓方代码 python -m SimpleHTTPServer 端口号# 默认是8000 这样就启动了一个简单的WEB服务器

  4. 使用python快速搭建本地网站

    如果你急需一个简单的Web Server,但你又不想去下载并安装那些复杂的HTTP服务程序,比如:Apache,ISS,Nodejs等.那么, Python 可能帮助你.使用Python可以完成一个简 ...

  5. 使用python快速搭建web服务器

    命令:python -m SimpleHTTPServer 8088 参考:https://www.cnblogs.com/harry-xiaojun/p/6739003.html https://w ...

  6. python 快速搭建文件服务器

    以http方式共享当前文件夹的文件 可实现跨平台文件传输 只需要一句话搞定 #python -m SimpleHTTPServer 8001 浏览器中输入 http://ip:8001  显示所有文件 ...

  7. PJzhang:python快速搭建局域网文件共享服务器

    猫宁!!! 参考链接:https://www.cnblogs.com/nopnog/p/8116848.html https://www.cnblogs.com/yili16438/p/d320932 ...

  8. 使用python快速搭建http服务

    python2语法:python -m SimpleHTTPServer python3语法:python -m http.server 在局域网中使用web去访问http:/IP:8000即可 可以 ...

  9. Python快速搭建HTTP服务器

        <wiz_tmp_tag id="wiz-table-range-border" contenteditable="false" style=&q ...

随机推荐

  1. Scala学习笔记--隐式转换

    隐式转换的规则:1.无歧义规则:隐式转换唯有不存在其他可插入转换的前提下才能插入  若编译器有两种方法修正x+y 如convert1(x)+y,convert2(x)+y,会报错2.单一调用规则:只尝 ...

  2. Angular2 - Starter - Pipes, Custom Pipes

    在Angular2 模板中,我们在显示数据时,可以使用通道将数据转换成相应的格式的值的形式来显示,而且这不改变源数据.比如,我们可以使用date通道来转换时间显示的格式: {{date | date: ...

  3. No enclosing instance of type test8 is accessible. Must qualify the allocation with an enclosing instance of type test8 (e.g. x.new A() where x is an

    在编译一个例子时,结果编译时出现: No enclosing instance of type test8 is accessible. Must qualify the allocation wit ...

  4. nginx的url重写[rewrite规则和参考]

    本日志内容来自互联网和平日使用经验,整理一下方便日后参考. Nginx Rewrite 相关指令有 if.rewrite.set.return 等. if 的语法 应用于 server 和 locat ...

  5. Codeforces 229D Towers

    http://codeforces.com/problemset/problem/229/D 题意:有n(1<=n<=5,000)座塔排在一条直线上,从左到右每个塔的高度分别为hi(1&l ...

  6. Vim 默认开启行号、语法显示等设置

      在终端下使用vim进行编辑时,默认情况下,编辑的界面上是没有显示行号.语法高亮度显示.智能缩进等功能的.为了更好的在vim下进行工作,需要手动设置一个配置文件:.vimrc. 在启动vim时,当前 ...

  7. [TI DLP Buglist]data type error in illum_EnableIllumination function

    I am debuging my code today, I find when my code is running, it's stop at illum_EnableIllumination() ...

  8. ListView之BaseAdapter

    BaseAdapter可以实现自定义的丰富子项视图,本文实现如下所示结果: 实现代码: /* ListView :列表 BaseAdapter 通用的基础适配器 * * */ public class ...

  9. poj 2385 Apple Catching(dp)

    Description It and ) in his field, each full of apples. Bessie cannot reach the apples when they are ...

  10. qt画刷和画笔

    # -*- coding: utf-8 -*- # python:2.x __author__ = 'Administrator' #画刷和画笔:QBrush 定义了 QPainter 的填充模式,具 ...