Nginx makes a great server for your Gunicorn-powered Django applications. In this article I will demonstrate how you can run multiple Django applications on the same Nginx server, hosting sites on two different domains. Each application will be set up in its own Virtualenv and each will be owned by and run as a different user to limit consequences of a potential security breach.
The Grinder load testing framework is a good tool for stress testing your website or application. It can run tests in parallel on multiple machines, allowing you to check how your application would behave under heavy load. This makes it possible to determine your app’s weak points, so you can proceed to optimize them. Unfortunately the TCPProxy component provided with The Grinder sometimes produces flawed testing scripts. I created a simple tool called har2grinder, which produces Grinder test scripts from HAR files. This allows you to record a browsing session using Chrome’s DevTools and then run it in the Grinder.
If you want to run a Django application on WebFaction, you may simply use their automatic application creation scripts. Unfortunately, if you want to place your application in a Virtualenv, the automatic installer will not help you. I’m sure that WebFaction will eventually add an installer to set this up, but for now, you can use the following tutorial. In this text we set up a Django project in a Virtualenv running on WebFaction’s Apache with mod_wsgi.
Slides for a presentation I’m giving today at Warsaw’s Python User Group meetup PyWaw.
Redis is an in-memory key-value store, somewhat similar to Memcached. Because Redis keeps its dataset in memory, storage and retrieval is very fast. It’s a good idea to use this kind of solution for storing ephemeral application data, such as contents of the cache, or temporary information associated with active user sessions. This unburdens your database system from performing unnecessary read and write operations and can considerably speed up your application. Modules for using Redis together with Django are available and quite easy to set up.
Django is an efficient, versatile and dynamically evolving web application development framework. When Django initially gained popularity, the recommended setup for running Django applications was based around Apache with mod_wsgi. The art of running Django advanced and these days the recommended configuration is more efficient and resilient, but also more complex and includes such tools as: Nginx, Gunicorn, virtualenv, supervisord and PostgreSQL.
In this text I will explain how to combine all of these components into a Django server running on Linux.
Drupal is a great CMS system for deploying websites quickly and managing them easily. Traditionally Drupal was run on a LAMP stack, but this configuration does not necessarily offer the best performance for the system. These days you can squeeze more performance out of Drupal by running it on a LEMP (Linux-Nginx-MySQL-PHP) stack in which Apache is replaced by the Nginx reverse-proxy. Further performance improvement can be gained by hooking up memcached to handle cacheing. This article explains how you can prepare a professional LEMP server for your Drupal sites.
OS X has a nice functionality called services which allow you (and applications you install) to expand the functionality of your system by adding commands, which will be visible in a special menu. Services may also be available in contextual menus, for instance when you right-click on a file or folder in the Finder.
You may want to check your Google Analytics data programmatically. This allows you to write some logic around your analytics data, such as sending e-mails in certain situations or just providing a status update for you to inspect without the hassle of logging into your account with a browser.
For a simple example, I use a utility called GeekTool to display certain information, such as incoming email, directly on my desktop for quick reference. I decided to also display updates of my Analytics profiles in this way, displaying a daily summary of unique visitors for each site I monitor. The end result looks like this: