I am wondering if creating an accounts app in Django is a good practice.
Say you have a Django project named mysite
and you create inside two apps: core
, which holds some business logic, and accounts
.
mysite/accounts/urls.py
urlpatterns = [
url('^', include('django.contrib.auth.urls')),
]
mysite/mysite/urls.py
urlpatterns = [
url(r'^accounts/', include('accounts.urls')),
url(r'^core/', include('core.urls')),
]
mysite/accounts/templates/registration/login.html
{% extends "base.html" %}
{% block content %}
{# Content of login page #}
{% endblock %}
mysite/core/templates/base.html
<!DOCTYPE html>
<html>
<body>
{% block content %}{% endblock %}
</body>
</html>
And I create all the other necessary templates for the views in django.contrib.auth.urls
.
Of course we don't forget to plug the two apps:
mysite/mysite/settings.py
INSTALLED_APPS = [
'accounts.apps.AccountsConfig',
'core.apps.CoreConfig',
# ...
]
Is all of this good practice or should I integrate the whole accounts and authentication management in the core
app?