Reputation: 2572
I have a directory structure that looks like this:
project/
index/
about.html
index.html
forum.html
profile.html
settings.html
apple-touch-icon.png
static/
main.css
forum.css
main.js
forum.js
load-image.min.js
server.py
metaclass.py
mailing.py
errors.log
I'd like to be able to make cherrypy serve all of these files from index/
. However, I also want about.html
, index.html
, forum.html
, profile.html
, etc. to be accessible via /about
, /
, /forum
, /profile
, etc., so this is not the same as just simple static file serving. Also, I want to have some custom methods, like /login
, which needs a GET
and POST
, and pre-templated user profile pages. How can this be done?
Upvotes: 1
Views: 784
Reputation: 4578
Cherrypy is going to recursively serve the files in the index folder. What you are trying to do has more to do with the url path.
In your server.py you can attach the handler for /about.html to achieve what you want.
@cherrypy.expose
def about_html(self):
return open('/index/about.html')
hope this helps!
Upvotes: 1