找不到cherrypy 404

时间:2014-03-16 16:16:25

标签: php python cherrypy

我想从我的樱桃应用程序访问2个php文件。 我可以使用jQuery从cherrypy app获取dbmgmt.php。

$('#dbmgmt').click(function(){
    window.location.href='static/dbmgmt.php';
});

这是dbmgmt.php

<form method="post" action="addEntry.php">
        <fieldset data-role="collapsible">
            <legend>New Entry</legend>
            <label for="patientID">Patient ID:</label>
            <input name="patientID" id="patientID" placeholder="2 characters follow by 3 digits" value="" type="text" required>
            <label for="firstname">Patient Name:</label>
            <input name="firstname" id="firstname" placeholder="First Name" value="" type="text" required>
            <input name="lastname" id="lastname" placeholder="Last Name" value="" type="text">
            <label for="patientIC">Patient IC:</label>
            <input name="patientIC" id="patientIC" placeholder="Patient IC" value="" type="text" required>
            <label for="address">Address:</label>
            <input name="address" id="address" placeholder="Address" value="" type="text">
            <label for="phone">Phone Number:</label>
            <input name="phone" id="phone" placeholder="Phone Number" value="" type="text">

            <input value="Submit" type="submit">
        </fieldset>
    </form>

这是addEntry.php

<?php
echo "test";
$patientID = $_POST['patientID'];
$firstname = $_POST['firstname'];
$lastname = $_POST['lastname'];
$patientIC = $_POST['patientIC'];
$address = $_POST['address'];
$phone = $_POST['phone'];
@ $db = new mysqli('localhost', 'yusiang', 'lalalulu', 'hospital');
if (mysqli_connect_errno()) {
     echo 'Error: Could not connect to database.  Please try again later.';
     exit;
}
mysqli_query($db,"INSERT INTO PATIENT (patient_ID, first_name, last_name, patient_IC, address, phone)
VALUES ('$patientID', '$firstname', '$lastname', '$patientIC', '$address', '$phone')");

echo "Thank you!";
//header ('Location: dbmgmt.php');
     ?>

但是我收到以下错误:

    404 Not Found

The path '/static/addEntry.php' was not found.

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/_cprequest.py", line 656, in respond
    response.body = self.handler()
  File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/lib/encoding.py", line 188, in __call__
    self.body = self.oldhandler(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/_cperror.py", line 386, in __call__
    raise self
NotFound: (404, "The path '/static/addEntry.php' was not found.")

我读过有关404的一些问题,但我无法找到解决问题的具体方法。 注意:dbmgmt.php和addEntry.php都与{c}或js文件一起位于static文件夹中。

0 个答案:

没有答案