Bryan Pieper's Blog : Python

Looking for a bolt on DJango app to compress/minify your JavaScript and CSS files? I created the staticcomp Django app for just that purpose.

Benefits:

  • Ability to compress/minify JS/CSS files on-demand
  • Increase website performance by reducing the total number of JS/CSS file requests
  • Build modular JS/CSS files by page / section instead of relying on large files
  • No need to use date-based file names or query string values to force the browser to download changes to your JS/CSS files
  • Improved Google Page Speed score and SEO benefits from a faster overall website
  • Integrated with UglifyJS, the same JavaScript compressor used by jQuery
  • Allows you to create your own backends or use one of the four existing

memcachedThePiepers.net serves the compressed JS and CSS files using the nginx memcached module. The python backend compresses the content and stores the content in memcached to be served via nginx.

This weekend, I upgraded to Django 1.3. After some testing, the JS and CSS files were bypassing memcached and being served by python. As you can imagine, this is not the most efficient method to serve static content.

Let me begin by stating this is not the only solution to preventing spam, but rather a compromise between annoying inputs (reCAPTCHA, math inputs, etc) and making forms more difficult for spam bots. I personally cannot stand having to input reCAPTCHA values, though, it is a proven technique for mitigating spam. If you are going to use Akismet, I prefer to use it as one of two lines of defense since it can produce false positives and doesn't stop unknown signatures.

Rather, I prefer the honeypot for small to medium-sized sites. It takes the irritation out of forms that also improves form conversions. Happy visitors, unhappy spam bots ;-)

Django uWSGII recently upgraded the uWSGI instance on my server from v0.9.5 to v0.9.6 and ran into a small glitch in the process.

After compiling uWSGI and recompiling nginx, the process seemed work as expected. I fired up Django and hit homepage. Then, I refreshed a few times and got this error message “uWSGI wsgi application not found.”

At first I thought this was odd because the initial request worked but it was the successive requests beyond the number of processes that caused the issue.

1 2 3