Skip to content

Instantly share code, notes, and snippets.

View mkoistinen's full-sized avatar

Martin Koistinen mkoistinen

  • Chapel Hill, NC, USA
View GitHub Profile
@mkoistinen
mkoistinen / gist:7685612
Created November 28, 2013 00:45
This Redmine init script works great for me for my install on unicorn + Nginx + Ubuntu 12.04 LTS. I hacked it up from the GitLab init script.
#! /bin/sh
# REDMINE for Nginx + Unicorn init script
# improvised from the awesome work maintained by the GitLab team:
# Credit to: @randx and others at GitLab
### BEGIN INIT INFO
# Provides: redmine
# Required-Start: $local_fs $remote_fs $network $syslog redis-server
@mkoistinen
mkoistinen / language_middleware.py
Last active December 17, 2015 13:59
Redirects requests that are not prefixed with a language segment to the right content in the default language. Also, if a URL is encountered that has a language prefix when it shouldn't, it will remove it. This is originally based on http://ilian.i-n-i.org/language-redirects-for-multilingual-sites-with-django-cms/ but modified to support django-…
# -*- coding: utf-8 -*-
import re
from django.conf import settings
from django.http import HttpResponseRedirect
from django.utils import translation
from django.utils.translation import get_language_from_request
#