Then we can add the middleware: MIDDLEWARE_CLASSES = ( 'ip2language.middleware.LanguagePreferenceMiddleware', ... )

And it's important to add a setting to specify what language codes should be mapped to what language codes. This allows us to arbitrarily assign different fallbacks for different languages: GEOIP_LANGUAGES = { 'NL': 'nl', 'BE': 'fr', }The keys in this dictionary should be a subset of the country codes supported by maxmind. For reference, this list can be viewed here: http://dev.maxmind.com/geoip/codes/iso3166The corresponding values can be any language code that's valid in the django project. The middleware will end up using this code in the redirect url.

Next, we will set a universal fallback: GEOIP_FALLBACK_LANGUAGE = 'en'This means that any visitor who is not in one of the specified countries, will view the content associated with the 'en' language code.

* geoip dat file locLastly, we need to tell the module where it can find a valid geoip database: GEOIP_DATABASE = '/usr/share/GeoIP.dat'