Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/325.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
Javascript 网页未显示我的css_Javascript_Python_Html_Css - Fatal编程技术网

Javascript 网页未显示我的css

Javascript 网页未显示我的css,javascript,python,html,css,Javascript,Python,Html,Css,我在Raspberry Pi上的cherrypy上主持一个测试网页。以下是我的python文件代码: #!/usr/bin/python import cherrypy class Control: @cherrypy.expose def index(self): return '''<!DOCTYPE html> <html> <head> <

我在Raspberry Pi上的cherrypy上主持一个测试网页。以下是我的python文件代码:

#!/usr/bin/python

import cherrypy

class Control:

    @cherrypy.expose
    def index(self):
        return '''<!DOCTYPE html>
        <html>
            <head>
                <title>RaspiCare</title>

                <meta name="viewport" content="width=device-width, initial-scale=1">

                <link rel="stylesheet" href="static/jquery.mobile-1.4.0.min.css">
                <link rel="stylesheet" href="static/style.css">
                <script src="static/jquery-1.10.2.min.js"></script>
                <script src="static/jquery.mobile-1.4.0.min.js"></script>


            </head>
            <body style="overflow: scroll;overflow-x:hidden;">
                            <div data-role="page" data-theme="a" id="page1">

                <div data-role="header">
                    <img src="static/raspicare_logo.png">

                </div><!-- /header -->

                </div>

            </body>
        </html>
                '''
    @cherrypy.expose
    def turnCamera (**data):

            import pigpio
            import time

            # import serial
            # def servo_control(command):
            # serialport= serial.Serial ("/dev/ttyACM0", 9600, timeout=0.5)
            # serialport.write(command)
            # return serialport.readlines(1)

            servos=4
            key = data['direction']
            if key=="left":
                    servostatus = "left"
                    print servostatus
                    m=1500
            else:
                    m=1000

    ##    m=1500
    ##    while (m >= 500 and m <= 2500):
    ##        if (key =="left"):
    ##            print "left"
    ##            m=m+100
    ##        elif (key =="right"):
    ##            m=m-100

            pigpio.start()

            pigpio.set_servo_pulsewidth(servos, m) 
            servostat= "Servo {} {} {} micro pulses".format(servos[0], key, m)
            print servostat
            time.sleep(1)

            pigpio.stop()

            return servostat


    #shutdown server
    @cherrypy.expose
    def shutdown(self):  
        cherrypy.engine.exit()

import os.path
tutconf = os.path.join(os.path.dirname(__file__), 'tutorial.conf')

if __name__ == '__main__':
    # CherryPy always starts with app.root when trying to map request URIs
    # to objects, so we need to mount a request handler root. A request
    # to '/' will be mapped to Comfort().index().
    cherrypy.quickstart(Control(), config=tutconf)
else:
    # This branch is for the test suite; you can ignore it.
    cherrypy.tree.mount(Control(), config=tutconf)
#/usr/bin/python
进口樱桃
类控制:
@樱桃树
def索引(自):
返回“”'
锉刀
'''
@樱桃树
def turnCamera(**数据):
进口pigpio
导入时间
#导入序列号
#def伺服控制(命令):
#serialport=serial.serial(“/dev/ttyACM0”,9600,超时=0.5)
#serialport.write(命令)
#返回serialport.readlines(1)
伺服系统=4
键=数据[“方向”]
如果键==“左”:
servostatus=“左”
打印伺服状态
m=1500
其他:
m=1000
##m=1500

##而(m>=500和m已解决

这与cherrypy的配置文件有关。
tutorial.conf
必须修改如下:

[global]
server.socket_host = "0.0.0.0"
server.socket_port = 8080
server.thread_pool = 10
[/]
tools.staticdir.root = "/directory to the static folder"
[/static]
tools.staticdir.on = True
tools.staticdir.dir = "static"

听起来您的文件路径不正确。对文件的请求是否返回404?您的所有文件是否都是静态的,包括页面本身?那么您不需要在路径中使用“static/”。此文件与
static
文件夹位于同一目录中,因此我假设我必须放置“static”并尝试删除“static/”。它假设您的文件位于一个名为static的子目录中,相对于页面。即使我拖出png文件以将tgt与python文件放在一起,它也没有给我任何提示哦,我想我误读了您的评论