views:

420

answers:

4

I've created unmaintainable websites using PHP because it was so easy to do things quick and dirty. I don't want to do the same thing with Python/Django on Google's appengine.

Is there any good architecture references for creating websites using Django and appengine? (E.g. where to put business logic, where to put data access logic, how to cleanly separate the views, how to do unit testing, etc.)

+1  A: 

Django by its nature will make it harder to put things in the wrong places. That is one of the cool things about the new generation of MVC frameworks, you have to work at it to create a ball of mud.

Matt Briggs
+1 Its not impossible to mangle Django or Pylons into a mess but it is harder then most of the PHP equivalents.
David
A: 

As already mentioned, by choosing Django, you have already taken a big step in avoiding spaghetti. Django provides you with an MVC framework (Model Template View to be djngo specific). Thus, your job now is to study and properly follow the MVC design pattern which Django is guiding you with. Where you place your business logic will depend on your specific application and requirements. In some cases, some business logic is placed closer to the data in the models, and in other times its placed in the controller. Furthermore, GAE doesn't require Django and in some cases GAE's webapp framework should suffice.

fuentesjr
+2  A: 

Keep in mind the version of Django included with App Engine is incomplete and needs to be updated if you want all the MVC features.

After my own experience building a few apps I recommend just sticking to the built-in webapp framework if you anticipate writing less than 2 or 3000 lines of code. It is manageable and imho you won't gain much from going to Django, but your source tree will be a lot messier with all the Django framework files.

Brandon Thomson
A: 

If you decide to not use Django, these hints from Werkzeug team might be interesting. This application structure takes what's best from Django but gives you complete freedom over actual layout (no need to have models.py even if you do not have any model in application...).

zgoda