Skip to main content

django-user-app

This package contains a user app for Django 3 projects.

This application is based on Bootstrap v4.5.0.

What does provides the user app ?

The following features are availables :

  • Social Network connections
    • Github
    • Google
    • Twitter
    • Facebook
  • Profile edition
  • User edition
  • Bootstrap style

How to install ?

Install the app in settings.py :

INSTALLED_APPS = [
    [...]
    'social_django',
    'crispy_forms',
    'user_app',
]

Specify static files and media files in settings :

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'var/static/')
MEDIA_URL = '/media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'var/media/')

Then add the settings for social-auth-app-django and 'django-crispy-froms' packages, for example :

CRISPY_TEMPLATE_PACK = 'bootstrap4'

USER_APP_PROVIDERS = [
    {
        "provider": "google-oauth2",
        "name": "Google",
        "link": None,
        "username": None,
    },
    {
        "provider": "github",
        "name": "Github",
        "link": "https://github.com/{{ data.login }}",
        "username": "{{ data.login }}",
    },
    {
        "provider": "twitter",
        "name": "Twitter",
        "link": "https://twitter.com/{{ data.access_token.screen_name }}/",
        "username": "@{{ data.access_token.screen_name }}",
    },
    {
        "provider": "facebook",
        "name": "Facebook",
        "link": None,
        "username": None,
    },
]

AUTHENTICATION_BACKENDS = (
    'django.contrib.auth.backends.ModelBackend',
    'social_core.backends.google.GoogleOAuth2',
    'social_core.backends.github.GithubOAuth2',
    'social_core.backends.twitter.TwitterOAuth',
    'social_core.backends.facebook.FacebookOAuth2',
)

SOCIAL_AUTH_GOOGLE_OAUTH2_KEY = ""
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET = ""
SOCIAL_AUTH_GITHUB_KEY = ""
SOCIAL_AUTH_GITHUB_SECRET = ""
SOCIAL_AUTH_TWITTER_KEY = ""
SOCIAL_AUTH_TWITTER_SECRET = ""
SOCIAL_AUTH_FACEBOOK_KEY = ""
SOCIAL_AUTH_FACEBOOK_SECRET = ""

LOGIN_REDIRECT_URL = "/accounts/profile/"
SOCIAL_AUTH_URL_NAMESPACE = 'social'
AUTH_PROFILE_MODULE = 'user_app.Profile'

SOCIAL_AUTH_PIPELINE = (
    'social_core.pipeline.social_auth.social_details',
    'social_core.pipeline.social_auth.social_uid',
    'social_core.pipeline.social_auth.social_user',
    'social_core.pipeline.user.get_username',
    'social_core.pipeline.social_auth.associate_by_email',
    'social_core.pipeline.user.create_user',
    'social_core.pipeline.social_auth.associate_user',
    'social_core.pipeline.social_auth.load_extra_data',
    'social_core.pipeline.user.user_details',
)

SOCIAL_AUTH_LOGIN_REDIRECT_URL = '/accounts/profile/'
SOCIAL_AUTH_NEW_USER_REDIRECT_URL = '/accounts/profile/'
SOCIAL_AUTH_DISCONNECT_REDIRECT_URL = '/'

Then add the urls to the urlpattern of the project :

from django.conf import settings
from django.conf.urls.static import static
#from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    #path('admin/', admin.site.urls),
    path('accounts/', include('user_app.urls')),
    path('accounts/', include('django.contrib.auth.urls')),
    path('', include("social_django.urls", namespace="social")),
] + static(
    settings.STATIC_URL,
    document_root=settings.STATIC_ROOT
) + static(
    settings.MEDIA_URL,
    document_root=settings.MEDIA_ROOT
)

And finally add the context_processor :

user_app.context_processors.providers_settings

Then you have to migrate the database with python3 manage.py migrate

How to overdrive the templates ?

First, you have to locate the templates into the site-packages/user_app/templates folder.

Then create a new template with the same name and you will be able to overdrive templates.

Metadata

Release files for django-user-app 0.0.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-user-app 0.0.6
File Size Uploaded Provenance Actions
django-user-app-0.0.6.tar.gz 9.9 kB Without provenance Details for django-user-app-0.0.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-user-app 0.0.6
File Interpreter ABI Platform Actions
django_user_app-0.0.6-py3-none-any.whl Python 3 none any Details for django_user_app-0.0.6-py3-none-any.whl

Total release size: 27.0 kB

Release files / django-user-app-0.0.6.tar.gz

Download URL django-user-app-0.0.6.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
1a144e0a678f9768b9e4b150e8a80a4d8efba8bd6b62066528e4d4d7bac81e03
BLAKE2b-256 checksum
How to use checksums
57829ca9ca78a9e1faaf9b3562e2afcf9e21f1b44e6ea257eb8ae402e37d3201
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

Release files / django_user_app-0.0.6-py3-none-any.whl

Download URL django_user_app-0.0.6-py3-none-any.whl
Size 17.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
03d639d8256b990dfda92be3535aa0d6d320d7c7f29d7539184572d0a779d32c
BLAKE2b-256 checksum
How to use checksums
2a8bde7c37cdeaddef7e744a024e1b907247a1f773ddd73493940f134bc0316b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.3

Security for django-user-app 0.0.6

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page