1👍
Transfer some parts of your app to different microservices. This will make some parts of your app focused on doing one or two things right (e.g. event logging, emails). Code coupling is also reduced and different parts of the site can be tested in isolation as well.
The microservice architecture style involves developing a single application as a collection of smaller services that communicates usually via an API.
You might need to use a smaller framework like Flask.
Resources:
For more information on microservices click here:
http://martinfowler.com/articles/microservices.html
http://aurelavramescu.blogspot.com/2014/06/user-microservice-python-way.html
2👍
For testing, you should mock your dependencies. The logging and mailing component, for example, should be mocked during unit testing of the views. I would usually use python-mock, this allows your views to be tested independently of the logging and mailing component, and vice versa. Just assert that your views are calling the right service calls and mock the return value/side effect of the service call.
You should also avoid touching the database when doing tests. Instead try to use as much in memory objects as possible, instead of Application.objects.create()
, defer the save()
to the caller, so that you can test the services without having to actually have the Application in the database. Alternatively, patch out the save()
method, so it won’t actually save, but that’s much more tedious.
- [Django]-ManagementForm data missing error while formset validation
- [Django]-Can I include partial view in Web2Py, passing specific variables into it?
- [Django]-Django – can't get highchart to display data
0👍
First, try to brake down your big task into smaller classes. Connect them with usual method calls or Django signals.
If you feel that the sub-tasks are independent enough, you can implement them as several Django applications in the same project. See the Django tutorial, which describes relation between applications and projects.
- [Django]-How to redirect a Django template and use the 'Next' variable?
- [Django]-Uploading csv file django using a form
- [Django]-Django admin pass variables to users and groups template
- [Django]-Redirect to admin for login
- [Django]-How do I pass a JSON object to FullCalendar from Django (by serializing a model)?