Django WordPress Auth
Introduction
Allows for access in Django to a WordPress installation for checking for things like login status.
Requirements
Python Dependencies:
WordPress Dependencies:
Installation
Add your WordPress’s auth keys and salts (found in wp-config.php) to your settings.py.
WORDPRESS_LOGGED_IN_KEY = "rs&^D%jPdu=vk|VVDsdfsdgsdgsdg9sd87f98s7h[Xm$3gT/@1xdasd"
WORDPRESS_LOGGED_IN_SALT = "3]x^n{d8=su23902iu09jdc09asjd09asjd09jasdV-Lv-OydAQ%?~"
Add your WordPress database to DATABASES in settings.py.
DATABASES = {
'default': {
... # default django DB
},
'wordpress': { # must be named 'wordpress'
'ENGINE': 'django.db.backends.mysql',
'NAME': 'wordpress',
'USER': '...',
'PASSWORD': '...',
'HOST': '...',
'PORT': 3306,
}
}
Add the middleware to MIDDLEWARE_CLASSES in settings.py. Make sure it’s placed somewhere after the session middleware.
MIDDLEWARE_CLASSES = (
'django.contrib.sessions.middleware.SessionMiddleware',
# ...
'wordpress_auth_lite.middleware.WordPressAuthMiddleware',
)
Finally, add wordpress_auth_lite to INSTALLED_APPS.
INSTALLED_APPS = (
# ...
'wordpress_auth_lite',
)
Usage
To restrict a view to users that are authenticated with WordPress: wordpress_requires_role decorator.
from wordpress_auth_lite.decorators import wordpress_login_required
@wordpress_login_required
def my_view():
pass
Finally, the middleware provides access to the WordPress user via request.wordpress_user.
See models.py for full reference. Some of the redundant naming conventions in the WordPress database have been made simpler as well.
Metadata
Release files for django-wordpress-auth-lite 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-wordpress-auth-lite-0.1.0.tar.gz | 4.3 kB | Without provenance | Details for django-wordpress-auth-lite-0.1.0.tar.gz |
Release files / django-wordpress-auth-lite-0.1.0.tar.gz
| Download URL | django-wordpress-auth-lite-0.1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f5da140d03b0d169ace61ca7afaec1cb20bf92ccda08224080c07c057479f178
|
|
BLAKE2b-256 checksum How to use checksums |
a396a0c406930d50d94d2f7c03ff55e77243f67a43ef0e2040b31416c1716a18
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-wordpress-auth-lite 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.