A Django app to plug Terraso as a provider to django-allauth.
Project description
Terraso django-allauth provider
Pluggable Django app to add Terraso as a provider to django-allauth.
Installation
Install the latest version of the terraso-allauth
package running:
pip install terraso-allauth
Add the terraso_allauth
app to the Django's INSTALLED_APPS
along with proper django-allauth
apps.
INSTALLED_APPS = [
# ...
"allauth",
"allauth.account",
"allauth.socialaccount",
"terraso_allauth",
# ...
]
Add Terraso configuration to the SOCIALACCOUNT_PROVIDERS
on settings:
SOCIALACCOUNT_PROVIDERS = {
...
'terraso': {
'SCOPE': [
'email',
'openid',
'profile',
],
},
...
}
Optionally, you can set a TERRASO_BASE_API_URL
to integrate with a Terraso instance differently from the default one. On your settings.py
:
TERRSO_BASE_API_URL = "https://your.terraso.org"
Usage
The Terraso's URL for authorization, token exchange and profile information is automatically loaded by django-allauth
following its default standards. If the installation processed described above was done correctly, you should now be able to start the OAuth authorization flow, accessing the proper Terraso authorization URL. For example:
<form action="{% url "terraso_login" %}" method="post">
{% csrf_token %}
<button type="submit">Login with Terraso</button>
</form>
Development
Installing development dependencies
We highly recommend creating a local virtualenv for local development.
To have terraso-allauth
set up locally for development, it's only a matter of installing a few development libraries. The following helper make action can help:
make install-dev
Updating dependencies
All project dependencies are set in the requirements files located under the requirements/
directory. The project is expected to run (and be tested) against different Django versions. That's the reason for similar requirement files.
If a dependency need to be added (or updated) do not change any requirement*.txt file. Instead, update the proper requirement*.in file.
All requirement*.txt
file are generated by pip-tools
. To generate them, you can run the helper make actions below:
make lock
make lock-dev
Running the tests
Before running tests, make sure you have the local django-allauth
library installed in your virtualenv
. It's recommended to installed it in edit mode:
pip install -e .
The tests can be run calling pytest
on library directory (the same directory of this README file):
pytest
Important: make sure you have the development dependencies installed. make install-dev
can make the job.
Running the tests across different environments
The project uses tox to run the tests on all supported environments (different Python and Django versions). The current setup relies on pyenv to load different Python versions. So, make sure you have your environment ready for it.
To run tox
, we recommend running it in parallel:
tox -p
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for terraso_allauth-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5187913a6401da0bb2cc1b19644722d40b746ac72959e03fb8437c4e0345083 |
|
MD5 | 1e23a984e99d82cf7c370b1793ecf406 |
|
BLAKE2b-256 | baa01a0da8036c2b875514989a9e53fc415a29649e887797d6da66f996e04c76 |