go-django

module
v0.0.0-...-189ea69 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 15, 2014 License: MIT

README

go-django - work with Django data in Go

go-django is not a web framework, instead it is a collection of utilities to help Go webservers integrate with Django servers.

Initially, it exposes a single method, signedcookie.Decode, which will decode the payload of a cookie generated with Django's signed_cookie session backend, using either the JSON or Pickle serializer. It should be simple to extend to writing cookies Django can read.

usage

First, go get it:

$ go get -u github.com/bpowers/go-django/...

Then import and use:

package main

import "github.com/bpowers/go-django/signedcookie"

const SecretKey = "64d446b6cabc3038d4c4398d210aaa5122b6bc5a"

var Pickle, MaxAge = signedcookie.Pickle, signedcookie.DefaultMaxAge

func example(cookie string) {
     session, err := signedcookie.Decode(Pickle, MaxAge, SecretKey, cookie)
     if err != nil {
         panic(err) // FIXME: elegantly propagate error
     }
     _ = session // use session; it is a map[string]interface{}
}

license

go-django is offered under the MIT license, see LICENSE for details.

Directories

Path Synopsis
internal
github.com/kisielk/og-rek
Package ogórek is a library for decoding Python's pickle format.
Package ogórek is a library for decoding Python's pickle format.
The signedcookie package implements read-only access to cookies generated by Django's signed_cookies session backend.
The signedcookie package implements read-only access to cookies generated by Django's signed_cookies session backend.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL