It's an incredibly easy method of adding serialization to any page of your Django app. Whereas the wonderful Django-REST-Framework provides everything you need to make a "complete" API for your site, it's fairly complicated and takes a good deal time to set up. Django-Easy-API has very a different philosophy: every page should be serializable, and it should be incredibly easy to set up.
That's why with Django-Easy-API, you can give your whole site an API with only a single line of code!
Need to debug a Django website or API that you're building, but don't want to disrupt service for other developers or clients using your app? Well then, you're in luck, because this tip is for you!
If you don't know already, the python debugger, aka pdb, is the best tool ever. Just call pdb.set_trace() in your python apps and get an interactive shell wherever you want.
How often have you written queries using the Django ORM, just to forget about them a second later as soon as you get the results you're looking for? Even if you do drop down to writing SQL, it's still easy to forget that down the road certain queries can have a negative performance impact on your project.
Fortunately, the Django-debug-toolbar can be used to identify processes that take up the most time when rendering a certain page.
Models are a core concept of the Django framework. According to Django’s design philosophies for models, we should be as explicit as possible with the naming and functionality of our fields, and ensure that we’re including all relevant functionality related to our model in the model itself, rather than in the views or somewhere else. If you’ve worked with Ruby on Rails before, these design philosophies won’t seem new as both Rails and Django implement the Active Record pattern for their object-relational mapping (ORM) systems to handle stored data.
For some reason, back when the language of the web was still being solidified, people forgot about timezones. The W3C remembered that not everybody speaks English, so they included the 'Accept-Language' HTTP Header, but apparently they never considered that users might not be in the same timezone as their server, so they forgot to include an 'Accept-Timezone' header. Since then, all web developers have been had the responsibility for figuring out the timezones of their users, rather than allowing their clients to do it automatically. This has resulted in a lot of horrible user experiences and misprinted time information over the years.
This tutorial answers the question, "How do I setup a Django project from scratch?". Since you're reading this, I assume (I hope, at least) you know that Django is a Python web framework built for rapid web development. We'll go through the setup process on both Windows and Unix environments, detailing the basic installation procedures of Django v1.5 and the dependencies required as well as a few additional libraries/extensions to get you started developing ASAP.
Dokku is a "Docker powered mini-Heroku" that you can deploy on your own server to serve as your own private PaaS.
Why would you want your own mini-Heroku? Well, Heroku can cost money, it's hosted in the cloud and you may not want your application to leave the room just yet, it doesn't support WebSockets or long-polling, you don't have 100% control over all aspects of the platform and/or maybe you're just the DIY kind of person.
Moving from smaller projects with only a few apps to complex larger projects is difficult to do. In most cases, you have to get your hands dirty, work on a few bug fixes to familiarize yourself with the codebase. Before that though, it's important to set the proper groundwork by establishing expectations with the client and analyzing the code from a higher level.
When approaching a project, focus on the following areas to quickly get up to speed with the codebase and determine the unknowns.
As our search results are now rendered on the client-side rather than on the server, we had to write a whole new API to get the data into the client. Once we had written it, we found that it was far slower than what we considered to be acceptable - results were averaging at 1.7s - and we shoot for sub 200ms response times. Not good! But what was going wrong? Why was Django being so slow? It actually wasn't easy to see immediately, and the normally wonderful Django Debug Toolbar wasn't any use as it doesn't work on AJAX requests.
Django, as a web framework, uses templates as a way of producing static HTML from the output of a Django view. In practice, Django’s templates are simply HTML files, with some special syntax and a set of tools which lets Django render the HTML page on-the-fly for the visiting user. Templates are highly customizable, but are meant to be simple, with most of the “heavy” logic going into the view. Let’s dive deeper and learn some standard ways of dealing with common problems.