开发者

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

开发者 https://www.devze.com 2023-03-07 17:37 出处:网络
I\'m new to CherryPy, coming from Django. I liked the way Dj开发者_开发知识库ango split the various parts of the project into many files, and I\'d like to do the same in CherryPy, instead of having on

I'm new to CherryPy, coming from Django. I liked the way Dj开发者_开发知识库ango 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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消