Monday, March 30, 2015

Re: Enterprise software patterns for django/Python ?

Hello.

Django is full-stack *web* framework, so it has some web-specific shortcuts, and probably does not fit ideally in enterprise patterns. 
For example, it does not encourage you to have "backend server" and "frontend server" connected via SOAP/XML/ESB like in "classical" enterprise approach. 

How ever:
1) Django managers and querysets (ORM) are database access layer. You should always access persistence storage via Django managers. Users.objects.find_all_users(in='Europe'). 
2) Django model is service layer / domain layer. Model should be fat and have business-specific API. Like user.do_some_business()
3) Security: Django gives you ability to set permissions to concrete classes. Some 3rd party Djagno apps allows you to set permissions even to concrete instances. You may use decorators in URLConf or mixins in view classes to force user to authenticate.
4) Check https://docs.djangoproject.com/en/1.7/topics/testing/ for unit and integration testing (you may also check ideas of BDD and Selenium)
5) In Django, you may scale your apps by moving database, webserver and cache layer of different clusters. Nothing prevents you from having 10 machines in database cluster and 10 machines in cache cluster. It works. 
6) Dependency Injection: you may use your settings.py for such purposes. In Django you install app by adding it to INSTALLED_APPS. And new app automatically participates in all stages after it. That is classical dependency injection, is not it?
7) In Python, we use Celery for async queues and Enterprise Integration Patterns. It integrates with Django well.

You should read Django tutorial (on Django website), Django references and some books like "Two Scoops of Django: Best Practices for Django 1.5" (it is about 1.5, but it is ok for 1.7 as well).





On Monday, March 30, 2015 at 1:56:26 PM UTC+3, Jeff Mangan wrote:
Looking for info or links on design patterns and architecture references on building a web portal using Python and Django. Looking for things like how to model your solutions, layers, services, data and business logic, to promote scale, security, and performance. I have a Microsoft background and want to understand the same concepts of building cloud an app using the onion layer and SOLID design principles approach, service layer, domain layer, with unit and integration tests, etc... To build an app the could scale using things like dependency injection, stateless restful service layer, domain (ddd) layer, shared cross cutting concerns, with role based authentication and authoration ttl token security, and I think that's about it. That's how I would build an enterprise app with .net. Is this similar in python and django and are there any examples ?

Any guidance is greatly appreciated.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/04088983-c4b0-45c9-840e-b065bc0fecfb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment