djgo

module
v0.0.0-...-f5c6364 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: MIT

README

Welcome to djgo!

The goal of this module is to help transition from Django to Golang based projects. Currently, the functionality is limited to:

  • Django compatible base62 encoding (django.utils.baseconv
  • Django compatible signing (django.core.signing)
  • Password reset token generator (django.contrib.auth.tokens.PasswordResetTokenGenerator)

Example

import "gitlab.com/pennersr/djgo/signing"

// Should be equal to your SECRET_KEY
secretKey := "django.settings.SECRET_KEY"
// DefaultSalt matches Django's default
s := signing.NewSigner(secretKey, signing.DefaultSalt)
// Django's signing serializes to JSON first. As this library does not
// do that automatically, you'll need to make sure you input proper JSON
// yourself. Hence, the quoted string.
msg := []byte("\"Hello\"")
v := s.Dumps(msg, false)
// v now equals "IkhlbGxvIg:1gt9nB:MjzABsr4QbCwUnpTLEVf9ZWxtXg"

License

MIT

Directories

Path Synopsis
utils

Jump to

Keyboard shortcuts

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