Note that there are some explanatory texts on larger screens.

plurals
  1. POIntegrating CSS and CherryPy: How to fix the 404 "/" Not Found Error?
    primarykey
    data
    text
    <p>I've been working on testing Twitter Bootstrap with CherryPy 3.2.2, and have reviewed several of the SO posts, but have been unable to successfully get Cherry to run with my configuration files. I'm getting the infamous 404 error: "NotFound: (404, "The path '/' was not found.")". </p> <p>This is my file setup:</p> <ul> <li>/TwitApp (application directory) <ul> <li>testPy.py (my test application)</li> <li>config.conf (configuration file to add CSS)</li> <li>global.conf (global configuration for server socket, port, etc. I think this can go in config.conf?)</li> <li>/css (CSS folder) <ul> <li>bootstrap.min.css</li> </ul></li> <li>/js (javascript directory)</li> </ul></li> </ul> <p>This is my testPy.py code:</p> <pre><code> #!/usr/bin/env python import cherrypy class HelloWorld: def index(self): return '''&lt;!DOCTYPE html&gt;&lt;html&gt;&lt;head&gt; &lt;title&gt;Bootstrap Test&lt;/title&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt; &lt;!-- Bootstrap --&gt; &lt;link href="../css/bootstrap.min.css" rel="stylesheet" media="screen"&gt; &lt;/head&gt;&lt;body&gt; &lt;h1&gt;Bootstrap Test&lt;/h1&gt; &lt;button type="button" class="btn"&gt;Submit&lt;/button&gt; &lt;/body&gt;&lt;/html&gt;''' index.exposed = True #I tried this example that I found in the documentation and on previous posts with the same 404 result: #cherrypy.quickstart(HelloWorld(), "/", "config.conf") #I tried this one when I reviewed another post on here: cherrypy.config.update("global.conf") cherrypy.tree.mount(HelloWorld(),"/","config.conf") cherrypy.engine.start() cherrypy.engine.block() </code></pre> <p>At one point the [global] section of my global.conf file was the top section of my config.conf file, but I split the two up when I started using the mount, start and block methods. </p> <p>Here is my global.conf file:</p> <pre><code> [global] server.socket_host = "127.0.0.1" server.socket_port = 8080 log.screen: True log.error_file: "/Users/myUser/tmp/newproject/cherrypy.error" log.access_file: "/Users/myUser/tmp/newproject/cherrypy.access" </code></pre> <p>Here is my config.conf file:</p> <pre><code> [/] tools.staticfile.root = "/Users/myUser/tmp/newproject/TwitApp" [/css/bootstrap.min.css] tools.staticfile.on = True tools.staticfile.filename = "css/bootstrap.min.css" </code></pre> <p>This is the full error message: 404 Not Found</p> <pre><code> The path '/' was not found. Traceback (most recent call last): File "/Library/Python/2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/_cprequest.py", line 656, in respond response.body = self.handler() File "/Library/Python/2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/lib/encoding.py", line 188, in __call__ self.body = self.oldhandler(*args, **kwargs) File "/Library/Python/2.7/site-packages/CherryPy-3.2.2-py2.7.egg/cherrypy/_cperror.py", line 386, in __call__ raise self NotFound: (404, "The path '/' was not found.") </code></pre> <p>The articles I read through the most can be found here: <a href="https://stackoverflow.com/questions/9984378/cherrypy-returning-notfound-404-the-path-was-not-found">Cherrypy returning NotFound: (404, &quot;The path &#39;/&#39; was not found.&quot;)</a> and here: <a href="https://stackoverflow.com/questions/17120216/path-not-found-in-cherrypy">Path Not Found in CherryPy</a>. Can someone please advise what I'm doing incorrectly? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload