FourLabs Playground Auth
A Django app para integração de autenticação com o Playground.
Este aplicativo fornece funcionalidades para autenticar usuários usando um token de acesso Playground e gerenciar organizações e projetos de forma eficiente.
🚀 Instalação
Clone e instale o pacote diretamente do repositório:
pip install playground-auth
⚙ Configuração
1️⃣ Adicione no INSTALLED_APPS
No arquivo settings.py, inclua a aplicação:
INSTALLED_APPS = [
...
'fourlabs_playground_auth',
]
Definir local para criar as migrações
MIGRATION_MODULES = {
'fourlabs_playground_auth': 'custom_migrations.fourlabs_playground_auth',
}
Criar local para criar as migrações
mkdir -p custom_migrations/fourlabs_playground_auth
touch custom_migrations/fourlabs_playground_auth/__init__.py
2️⃣ Configure as Credenciais Playground
Defina as configurações necessárias para autenticação no Playground:
PLAYGROUND_URI = 'playground-uri'
SERVICE_ID = 'service-id'
3️⃣ Defina o Modelo de Usuário Padrão
Especifique o modelo de usuário personalizado para integração com o Playground:
AUTH_USER_MODEL = 'fourlabs_playground_auth.User'
🛠 Personalização de Campos do Projeto
O usuário pode definir dinamicamente os campos do modelo Project através do settings.py.
Exemplo:
PROJECT_CUSTOM_FIELDS = [
{"name": "playstore_link", "type": "URLField", "verbose_name": "Link Play Store"},
{"name": "appstore_link", "type": "URLField", "verbose_name": "Link App Store"},
{"name": "twitter_link", "type": "URLField", "verbose_name": "Link Twitter"},
{"name": "linkedin_link", "type": "URLField", "verbose_name": "Link LinkedIn"},
{"name": "rating", "type": "FloatField", "verbose_name": "Avaliação"},
{"name": "launch_date", "type": "DateField", "verbose_name": "Data de Lançamento"},
{"name": "active", "type": "BooleanField", "verbose_name": "Está Ativo?", "params": {"default": True}},
{"name": "support_email", "type": "EmailField", "verbose_name": "E-mail de Suporte"},
{"name": "description", "type": "TextField", "verbose_name": "Descrição Completa"},
{"name": "metadata", "type": "JSONField", "verbose_name": "Metadados Extras"},
]
Isso permitirá que o Django adicione esses campos automaticamente no modelo Project, sem necessidade de modificar o código-fonte.
🔄 Banco de Dados & Migrações
Após configurar o projeto, execute as migrações para refletir as alterações no banco de dados.
1️⃣ Criar as migrações
python manage.py makemigrations
2️⃣ Aplicar as migrações
python manage.py migrate
🌍 Uso
1️⃣ Adicione as URLs no urls.py
Para expor as rotas de autenticação, inclua no seu urls.py:
from django.urls import path, include
urlpatterns = [
...
path('auth/', include('fourlabs_playground_auth.urls')),
]
Isso garantirá que todas as funcionalidades de autenticação estejam acessíveis via /auth/.
📌 Recursos Principais
- ✅ Autenticação via token Playground
- ✅ Gerenciamento de usuários, organizações e projetos
- ✅ Campos personalizados para o modelo Project via settings.py
- ✅ Integração simples e flexível com qualquer projeto Django
📝 Licença
Este projeto está licenciado sob a MIT License.
Dicas para Atualizações
Aumente a versão em setup.py (version='0.1.1', por exemplo)
Apague a pasta dist/:
rm -rf dist/
Gere e envie novamente:
python setup.py sdist bdist_wheel
twine upload dist/*
Metadata
Release files for playground-auth 0.2.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| playground_auth-0.2.9.tar.gz | 19.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| playground_auth-0.2.9-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 45.3 kB
Release files / playground_auth-0.2.9.tar.gz
| Download URL | playground_auth-0.2.9.tar.gz |
|---|---|
| Size | 19.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
35763128b8573ff2fa6f2bd6a7a1067181d80768c5abbff57534e490dc0513b6
|
|
BLAKE2b-256 checksum How to use checksums |
b1c5c23b7d5930d7e2be6a95379bd1dceb001951e717ecfa6c8604907928d7ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|
Release files / playground_auth-0.2.9-py2.py3-none-any.whl
| Download URL | playground_auth-0.2.9-py2.py3-none-any.whl |
|---|---|
| Size | 25.8 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
b5c801a5c5d26e1f49ea3f0c2fffb7b181aa917b06a4d12a5b2b236f2754d6a1
|
|
BLAKE2b-256 checksum How to use checksums |
a540fd2d070cb2a96cd066ec24fbb2d827cb61af226a3b7b13e9bc3a0c9f3c5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.13
|