Author Picture

Kim Majali


Django Collectstatic

Author Avatar wrote on 30/05/2022

Collectstatic collects all static files inside all apps and put a copy inside the static directory declared in settings.py eg: confing/static/img/photo.jpg --> static/img/photo.jpg Important in production (when debug is false) because they will be served from that folder Read more

Django White Labelling

Author Avatar wrote on 30/05/2022

Check if user and page belongs to the same company

views.py
from accounts.utils import get_session_company, is_a_company_user Read more

Django Session

Author Avatar wrote on 30/05/2022

Setting Up Sessions

In settings.py
To the MIDDLEWARE_CLASSES
'django.contrib.sessions.middleware.SessionMiddleware'
And INSTALLED_APPS
'django.contrib.sessions' Read more

Django Current Domain/Path

Author Avatar wrote on 30/05/2022

(In a view)

request.scheme # http or https request.META['HTTP_HOST'] # example.com request.path # /some/content/1/

(In a template)

{{ request.scheme }} {{ request.META.HTTP_HOST }} {{ request.path }} Read more

Topics: ExtrasBasics

CRUDgen Django CRUD generator