Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CherryPy : Is there a best way to split the project in multiple files?

I'm new to CherryPy, coming from Django. I liked the way Django split the various parts of the project into many files, and I'd like to do the same in CherryPy, instead of having one big file.

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

  • application.py : The core of CherryPy, where the server starts
  • urls.py : Containing all the urls, probably using RoutesDispatcher
  • models.py : Via SQLAlchemy, containing all the models
  • controllers.py : Pretty obvious ;)

I'm not asking for a complete code paste here, a link to an example/pastebin/gist is perfect too :)

Thanks for your help.

like image 498
Cyril N. Avatar asked Feb 03 '23 18:02

Cyril N.


1 Answers

Well, I'll answer myself on that one :p

I found a Google Groups post that poses the basics on how to structure your CherryPy application.

In that post, there is a link to a Bitbucket CherryPy application example that is very well structured and could be used as a base example for any CherryPy application.

like image 62
Cyril N. Avatar answered Feb 05 '23 16:02

Cyril N.