Пример #1
0
func init() {
	tango.Settings.Set("debug", true)
	tango.Settings.Set("serve_address", ":8000")

	tango.Pattern("/", &IndexHandler{})
	tango.SetNotFoundHandler(&NotFoundHandler{})
}
Пример #2
0
func init() {
	tango.Settings.Set("debug", true)
	tango.Settings.Set("serve_address", ":8000")

	// Add the Runtime Profiler to our middleware stack. Same ordering rules as Django!
	tango.Middleware(&runtime.Profiler{})

	tango.Pattern("/", &IndexHandler{})
}
Пример #3
0
func init() {
	tango.Settings.Set("debug", true)
	tango.Settings.Set("serve_address", ":8000")

	// Setup PG Connection
	conf := fmt.Sprintf("dbname=%s user=%s password=%s host=%s port=%d sslmode=%s",
		tango.Settings.String("db_name", "postgres"),
		tango.Settings.String("db_user", "postgres"),
		tango.Settings.String("db_password", ""),
		tango.Settings.String("db_host", "127.0.0.1"),
		tango.Settings.Int("db_port", 5432),
		tango.Settings.String("db_sslmode", "disable"),
	)

	var err error
	Db, err = sql.Open("postgres", conf)
	if err != nil {
		panic(err)
	}

	// Now setup as you normally would.
	tango.Pattern("/", &IndexHandler{})
}
Пример #4
0
func main() {
	tango.Pattern("/", &IndexHandler{})
	tango.ListenAndServe()
}
Пример #5
0
func init() {
	tango.Settings.Set("debug", true)

	tango.Pattern("/", &IndexHandler{})
}