Skip to content

Instantly share code, notes, and snippets.

View pvilas's full-sized avatar
💭
Working on a financial webservice idea

Pere Vilas pvilas

💭
Working on a financial webservice idea
  • Cálida Ibiza, SA
  • Eivissa Ibiza (Spain)
View GitHub Profile
@Natim
Natim / language_app.py
Created August 18, 2012 08:40
Flask language_dispatch : Detect the user language and redirect to the right domain_name
# -*- coding: utf-8 -*-
import locale
import re
from flask import Flask, redirect, request
app = Flask(__name__)
LANGUAGE_CODES = ('fr', 'en', 'zh')
DOMAIN_NAME = 'example.com'
{% extends 'base.html' %}
{% import 'macros.html' as macros %}
{% block content %}
<div class="row">
<div class="col-xs-12 col-md-3 col-sm-4 col-sm-offset-4 col-md-offset-4 col-lg-3 col-lg-offset-4">
<div class="login-message">
Login to AwesomeService!
</div>
{% call macros.render_form(form, action_url=url_for('login_view'), action_text='Login',
class_='login-form') %}