- CSS 62.3%
- Python 23%
- Shell 7.9%
- HTML 5.9%
- Perl 0.8%
- Other 0.1%
| .data | ||
| .run.d | ||
| .vscode | ||
| django_project | ||
| django_tinyuser | ||
| doc | ||
| dockerfiles | ||
| git.hooks | ||
| httpd | ||
| staticfiles | ||
| .container-images.yaml | ||
| .dockerignore | ||
| .flake8 | ||
| .gitattributes | ||
| .gitignore | ||
| .gitmodules | ||
| Dockerfile | ||
| imagetab | ||
| LICENSE | ||
| LICENSE.django-project | ||
| LICENSE.django-project.md | ||
| LICENSE.django-tinyuser | ||
| LICENSE.django-tinyuser.md | ||
| LICENSE.md | ||
| manage | ||
| manage.py | ||
| manage.sh | ||
| package-lock.json | ||
| package.json | ||
| pmanage.sh | ||
| podman-build.sh | ||
| podman-push.sh | ||
| poetry.lock | ||
| pyproject.toml | ||
| README.md | ||
| requirements.dev.txt | ||
| requirements.prod.txt | ||
| requirements.txt | ||
| run.sh | ||
| update-requirements.sh | ||
Django TinyUser
Neither the app nor the documentation is finished yet, but I wanted to publish the project anyway, because I need it for my projects and I want to share it with others. If you want to contribute to the project, feel free to open a pull request or an issue.
Django TinyUser is a small user authentication app for django. It is meant to be used by projects that need a small user authentication for their projects and don't want to implement their own. It is used by my projects and docker images for basic user authentication using django-allauth.
This project is distributed under the 0BSD-License.
It uses django-allauth as backend and overloads the templates for Bootstrap and Tailwind CSS.
Links and Documentation
- Official documentation
- Django TinyUser on Codeberg
- Django TinyUser on GitHub
- Documentation of the dependencies:
Installation
Add TinyUser to your project using poetry
poetry add https+git://codeberg.org/c9moser/django-tinyuser.git
Configuration of your project
from django_tinyuser.global_templates.tailwindcss import PATH as TINYUSER_GLOBAL_TEMPLATES
...
# Register allauth and django_tinyuser
APPS = [
...
'allauth',
'allauth.account',
'allauth.socialaccount', # if you want to use social auth
# add the providers you want to use, e.g. 'allauth.socialaccount.providers.google',
'django_tinyuser',
...
]
If you use Bootstrap, you can add overloads to your TEMPLATES. The overloads are located in the global_templates folder of django_tinyuser. You can add them to your TEMPLATES like this is and they will be used instead of the default templates of django-allauth.
Note that you have to add the path to the overloads before the default templates of django-allauth, otherwise they will not be used.
And don't forget to add the context processors for django-allauth, and django-tinyuser otherwise the templates will not work.
from django_tinyuser.global_templates.bootstrap import PATH as TINYUSER_GLOBAL_TEMPLATES
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# Add Bootstrap overloads to TEMPLATES
'DIRS': [TINYUSER_GLOBAL_TEMPLATES],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
...
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django_tinyuser.context_processors.tinyuser'
...
],
},
},
...
]
If you use Tailwind CSS, you can add the overloads to your TEMPLATES like this is and they will be used instead of the default templates of django-allauth.
from django_tinyuser.global_templates.tailwindcss import PATH as TINYUSER_GLOBAL_TEMPLATES
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
# Add Tailwind CSS overloads to TEMPLATES
'DIRS': [TINYUSER_GLOBAL_TEMPLATES],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
...
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'django_tinyuser.context_processors.tinyuser'
...
],
},
},
...
]
You also need to set the CSS_FRAMEWORK option in your settings.py to the css framework you use,
otherwise the templates will not work.
CSS_FRAMEWORK = 'bootstrap' # if you use Bootstrap
# or
CSS_FRAMEWORK = 'tailwindcss' # if you use Tailwind CSS
# or
CSS_FRAMEWORK = 'custom' # if you use custom templates
And you need to set the AUTH_USER_MODEL to django_tinyuser.TinyUser in your settings.py or
to an overloaded model if you have customized the user model.
AUTH_USER_MODEL = 'django_tinyuser.TinyUser'
Then add the urls of django-allauth to your urls.py
from django.urls import path, include
urlpatterns = [
...
path('accounts/', include('allauth.urls')),
...
]
Finally run the migrations to create the required tables added by required apps, django-allauth and django-tinyuser.
python manage.py migrate
Configuration options to be added to your settings.py
CSS_FRAMEWORK
One of the following values:
- bootstrap - if you use Bootstrap (partially implemented, but not tested yet)
- tailwindcss - if you use Tailwind CSS (not implemented yet)
- custom - custom template (you need to overload all templates yourself and add the path to your TEMPLATES)
Note that the default value is 'bootstrap', so if you use Bootstrap, you don't need to set this option.
If you use Tailwind CSS, you need to set this option to 'tailwindcss', otherwise the templates will not work.
You can contact me under my Mastodon account if you have any questions or suggestions for the project. I am also open for contributions, so if you want to contribute to the project, feel free to open a pull request or an issue.