Django profiler: My journey to code optimization
The same way an ORM allows us to forget about SQL when writing queries to the database, migrations make sure we don’t write a single ‘ALTER TABLE’ in our schema changes. Some may argue that’s bad: we “lose control” over a critical part of our infrastructure, we don’t know how to write SQL anymore when needed, we’re not sure how that operation is really translated into SQL, etc, etc. Ok, these points are actually valid. However, Django migrations module is more than just a way of automatically generating and applying SQL statements, it’s also a transparent API to write your own database changes in Python. It comes with wheels for those who need it (or trust enough) and tools for those who like to get their hands dirty.
Get the report.
The slides look at how strings can be marked for translating using Django template tags, and methods from django.utils.translation in python code, template html and js.
DjangoCon Europe 2018 Call for volunteers
2018's DjangoCon Europe will be held in beautiful Heidelberg, from the 23rd to the 27th May. There is a lot to do, but it's very much worth it – DjangoCon Europe is an extremely friendly, open, inclusive, and informative (for beginners and advanced users alike) conference. We're looking for support in the following areas, but if you have other interests and want to help out, please contact us:
The code for this blog post is written using the Django Web Framework. The techniques discussed here will certainly work with other frameworks (and perhaps even compiled languages), but one core component that we’ll be leveraging here is the presence of an explicit mapping of URL routes to the views that handle requests to those routes.
This is the second part of Django project optimisation series. The first part was about profiling and Django settings, it's available here. This part will be about working with database optimisation (Django models).
SOTA-Py - 258 Stars, 9 Fork
© Sva prava pridržana, Kompjuter biblioteka, Beograd, Obalskih radnika 4a, Telefon: +381 11 252 0 272 |
||