Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用python Web服务器筛选SVG文件_Python_Svg_Cgi - Fatal编程技术网

使用python Web服务器筛选SVG文件

使用python Web服务器筛选SVG文件,python,svg,cgi,Python,Svg,Cgi,我想在从服务器生成的网页中筛选svg文件。 这是我的服务器: #!/usr/bin/python import BaseHTTPServer import CGIHTTPServer import cgitb; cgitb.enable() server = BaseHTTPServer.HTTPServer handler = CGIHTTPServer.CGIHTTPRequestHandler server_address = ("0.0.0.0", 8123) handler.cg

我想在从服务器生成的网页中筛选svg文件。 这是我的服务器:

#!/usr/bin/python

import BaseHTTPServer
import CGIHTTPServer
import cgitb; cgitb.enable() 

server = BaseHTTPServer.HTTPServer
handler = CGIHTTPServer.CGIHTTPRequestHandler
server_address = ("0.0.0.0", 8123)
handler.cgi_directories = ['/WEBSERVER']

httpd = server(server_address, handler)

try:    
    print "Running HTTP server"
    httpd.serve_forever()
except KeyboardInterrupt:
    print "Server Stoped"
这是我的剧本:

import cgitb
import cgi
print 'Content-type: text/html'
    print '''
    <html>
    <head>
    </head>

    <body>
    '''
print """<embed data="http://0.0.0.0:8123/WEBSERVER/358336657.svg" type="image/svg+xml"></embed>"""
导入cgitb
导入cgi
打印“内容类型:文本/html”
打印“”'
'''
打印
我的服务器是在WEBSERVER之前从repertory启动的。 我试过使用object,使用img,使用div,使用所有不同的路径,使用或不使用http,是否使用解析路径,在/tmp中,我试过使用777 chown,使用所有chmod组合,使用所有不同的DOCTYPE…都不起作用 屏蔽它的唯一方法是打开svg文件并打印它,但我不想这样,我想用地址调用它


有解决方案吗?

我不确定0.0.0.0在这种情况下是否是有效的IP地址。你试过127.0.0.1(本地主机)吗?没有,当我更改到这个ip时没有影响。我试图在服务器脚本中添加mimetype svg,但它不起作用,我真的不知道为什么。。。