CherryPy: Is there a better way to split a project into multiple files?

I am new to CherryPy coming from Django. I liked how Django split the various parts of the project into multiple files, and I would like to do the same in CherryPy, instead of having one large file.

I think it would be great if I could split the project in these parts:

  • application.py: CherryPy kernel, where the server starts
  • urls.py: contains all urls, possibly using RoutesDispatcher
  • models.py: through SQLAlchemy containing all models
  • controllers.py: Pretty obvious;)

I do not ask you to insert the full code here, the link to the / pastebin / gist example is also great :)

Thank you for your help.

+8
python cherrypy code-organization project-organization
source share
1 answer

Ok, I will answer myself this: p

I found a Google Group post that outlines the basics of the structure of your CherryPy app.

This post contains a link to an example CherryPy Bitbucket application , which is very well structured and can be used as a basic example for any CherryPy application.

+10
source share

All Articles