Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A few elixir libraries for working with django

License

NotificationsYou must be signed in to change notification settings

nicksanders/exdjango

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TravisHex.pmHex.pm

An elixir library for working with django

Warning: This is Alpha software and subject to breaking changes.

Features

  • Django cookie-based sessions
  • Django redis cache sessions
  • Django pbkdf2_sha256 passwords

Installation

Add ex_django to yourmix.exs dependencies other dependencies are optional depending on what features you want to use.

defpdepsdo[{:exdjango,"~> 0.4.0"}]end

If you need sessions you need to add poison

{:poison,"~> 3.0"},

If you need to read/write django passwords you need to add comeonin

{:comeonin,"~> 3.0"},

Django sessions

Add secret_key to config.exs and add either Cookie or Redis to endpoint.ex Plug config

# config.exsconfig:exdjango,:config,secret_key:"django-secret-key"# endpoint.explugPlug.Session,store:ExDjango.Session.Cookie,key:"sessionid"

or

# config.exsconfig:exdjango,:config,secret_key:"django-secret-key"redis_pool: MyApp.RedixPool# endpoint.explugPlug.Session,store:ExDjango.Session.Redis,key:"sessionid"

To use Redis session you need a redis connection pool seehttps://github.com/whatyouhide/redix for more information.

Set user / get user_id ("_auth_user_id" from django session)

conn|>ExDjango.Session.put_user(user)conn|>ExDjango.Session.get_user_id()

Django passwords

ExDjango.Pbkdf2.checkpw(password,user.password)changeset|>put_change(:password,ExDjango.Pbkdf2.hashpwsalt(changeset.params["plaintext_password"]))|>repo.insert()

About

A few elixir libraries for working with django

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp