Author archives: Mike
Linux Refuses to See the HDMI
Written by
on
in
Snaking,
Pony,
Tuxedo.
My talk at Django Toronto was scuttled by my computer refusing to recognize the HDMI (complained about a checksum failure when the HDMI was plugged in) and the further failure of the VirtualBox image to get onto the network so I could use another machine. We spent all of the prep time trying to get ...
Fail2ban + Django convenient format
Written by
on
in
Snaking,
Pony.
You want to use Django auth failures to generate fail2ban bans to protect against brute-forcing of your passwords. Nothing on django packages... So, you: wrap your login handler with a decorator that logs out messages on failures...
def log_login_failures( function ):
auth_log = logging.getLogger( 'django.auth' )
@wraps(function)
def wrapped( request, *args, **named ):
result = ...
avahi-daemon just works for hostname.local
Written by
on
in
Tuxedo.
So I wanted to set up my demo to be available at a friendly local URL when I run it tomorrow, so I decided to check out how avahi is doing these days.
sudo aptitude install avahi-server
Then edit /etc/avahi/avahi-daemon.conf
host-name=<yourhostname>
Restart avahi and your server will show up as <yourhostname>.local (or something similar, if ...
You got Video in my Django at Django Toronto
Written by
on
in
Snaking,
Pony,
Tuxedo.
Realized this morning that I offered to do a quick talk on how to get video running on your web-site at the Django Toronto tomorrow. So I've put together a small demonstration that shows creating HLS and RTMP streams (using nginx-rtmp), and a quick demo showing how to push to the server using a video-for-linux ...
Do I really need 0-copy?
Written by
on
in
Snaking,
Pony.
Nginx Upload Module's key feature/optimization is that as nginx streams the multipart post to disk, it directs the embedded files directly to separate file handles, you can then just move those files to the final location. So far everything I've seen to replace it has at least a couple of copies going on, as they ...
Generic Filter/Sort Tables for Django?
Written by
on
in
Snaking,
Pony.
So this came up (again). Users want to be able to look at a (largish) set of records in Django (millions of records) and do the following:
- click columns to sort by field values (with indication of sort direction, of course)
- filter by column values (include, exclude, greater-equal, less-equal); that is, they want to click ...
Compress your JS/CSS in Django
Written by
on
in
Snaking,
Pony.
Finally integrated webassets (django_assets) into our build process. Very nice interface (using the template-only approach). And other than a few issues with our pyc-only deployments, it pretty much "just worked" once I realized that adding the staticfile-finder for the development server is a critical requirement.
The changes to your settings look like this:
# use ...
Lazy Caching Proxy Results in Nginx
Written by
on
in
Snaking,
Pony,
Tuxedo.
If you are using nginx as your front-end server for Django, you can also use it as a proxy cache (for smaller websites). You configure the cache like so:
proxy_cache_key "$scheme://$host$request_uri"; proxy_cache_path /var/blog/cache levels=1:2 keys_zone=blogcache:120m; proxy_temp_path /var/blog/proxy; proxy_cache_valid 200 302 5m; proxy_cache_valid 404 1m; proxy_cache_use_stale updating; proxy_cache_bypass $cookie_sessionid; proxy_no_cache $cookie_sessionid;
The proxy_no_cache and proxy_cache_bypass lines ...
Toronto Django/Python Dates
Written by
on
in
Snaking.
The Django Toronto meetup this month is on the 13th, and the deadline for PyCon.ca presentation proposals is the 21st.
Blog Rebooted
Written by
on
in
Vindaloo.
I've moved the blog onto its own VPS, running Zinnia (a Django based blog platform). It's using the Zinnia Bootstrap theme, and hopefully most of the old content will have ported over properly. The server has a (free) SSL certificate, so you can, should you wish, browse or comment using SSL (I really can't imagine ...