Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
A Django package that provides 'out-of-the-box' JWT auth, user, group, and permission APIs for use in Single Page Apps (eg - Vue, React).
Readme
A Django package that provides "out-of-the-box" basic auth, user, group, and permission APIs for use in Single Page Apps (eg - Vue, React).
So easy, you can take a SPA day!
django-spaday
deliberately stays below version 1.x.x to signal that every new version may potentially have breaking changes.
NOTE:
django-spaday
is very opinionated as its for internal use.
Assumes you have started from this cookiecutter-django template which leverages the following.
Install Django SPA Day:
python3 -m pip install django-spaday
Add it to your INSTALLED_APPS
:
INSTALLED_APPS = (
...
'django_spaday',
)
In config/urls.py
add the urls:
urlpatterns = [
path(r"djadmin/", admin.site.urls),
...
path("", include("django_spaday.urls")),
]
In config/api_router.py
add the API urls:
urlpatterns = [
path("", include("django_spaday.api.urls")),
# Place all your app's API URLS here.
...
path("auth/", include("dj_rest_auth.urls")),
]
In config/settings/base.py
ensure your dj-rest-auth
settings include the following:
REST_AUTH = {
"USE_JWT": True,
"SESSION_LOGIN": False,
"TOKEN_MODEL": None,
"USER_DETAILS_SERIALIZER": "django_spaday.api.serializers.UserAuthSerializer",
"JWT_AUTH_HTTPONLY": False, # False means js can access the cookie
}
NOTE: This is imporatant as it will provide the frontend app with the logged in User's permissions, etc.
These are the SPA_DAY
defaults and do not need to be specified in settings
unless you wish to override.
SPA_DAY = {
"PERMISSION_SERIALIZER": "django_spaday.api.serializers.PermissionListSerializer",
"USER_SERIALIZER": "django_spaday.api.serializers.UserSerializer",
"GROUP_SERIALIZER": "django_spaday.api.serializers.GroupSerializer",
"CHANGE_PASSWORD_SERIALIZER": "django_spaday.api.serializers.ChangePasswordSerializer",
"USER_AUTH_SERIALIZER": "django_spaday.api.serializers.UserAuthSerializer",
"LAST_LOGIN_SERIALIZER": "django_spaday.api.serializers.LastLoginSerializer",
}
make env
make pip_install
make migrations
make migrate
make superuser
make serve
http://127.0.0.1:8000/djadmin/
for the Django Adminhttp://127.0.0.1:8000/api/docs/
for the API docsCurrently django_spaday has 95% test coverage.
make pytest
make coverage
make open_coverage
Command | Description |
---|---|
env | Create virtual environment |
env_remove | Remove virtual environment |
Command | Description |
---|---|
pip_install | install requirements |
pip_list | run pip list |
pip_freeze | run pipfreezer |
pip_checker | run pipchecker |
Command | Description |
---|---|
manage | run django manage.py (eg - make manage cmd="shell") |
superuser | Create superuser |
migrations | Create migrations (eg - make migrations app="core") |
migrate | Apply migrations |
serve | Run server |
show_urls | show urls |
shell | run shell |
flush | Flush database |
Command | Description |
---|---|
pytest | Run tests |
pytest_verbose | Run tests |
coverage | Run tests with coverage |
coverage_verbose | Run tests with coverage |
coverage_skip | Run tests with coverage |
open_coverage | open coverage report |
Command | Description |
---|---|
clean_build | remove build artifacts |
clean_pyc | remove python file artifacts |
clean | remove all build and python artifacts |
clean_pytest_cache | clear pytest cache |
clean_tox_cache | clear tox cache |
clean_coverage | clear coverage cache |
clean_tests | clear pytest, tox, and coverage caches |
Command | Description |
---|---|
tree | Show directory tree |
Command | Description |
---|---|
dist | builds source and wheel package |
release_test | upload package to pypi test |
release | package and upload a release |
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
ruff
and added testsproject/static/vue-frontend
)FAQs
A Django package that provides 'out-of-the-box' JWT auth, user, group, and permission APIs for use in Single Page Apps (eg - Vue, React).
We found that django-spaday demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.