Django
CookieCutter
https://github.com/cookiecutter/cookiecutter-django
- https://github.com/cruft/cruft - so you can update a cookiecutter project
Ideas for deploying to k8s
- https://github.com/boundcorp/cookiecutter-django-boundcorp - see deploy/chart
- Panel - Dashboarding solution
Reports and Charts with Django
Components
ORM
# update indexes manage.py update_index --remove # from ChatGPT: django example of getting data from two databases def get_data_from_db1(): with connections['db1'].cursor() as cursor: cursor.execute("SELECT * FROM myapp_mymodel") results = cursor.fetchall() return results
AsyncIO
Config
- Constance - Dynamic Django settings
Terminal Emulation Research
- https://github.com/KingWaffleIII/kommander — interesting configurations
Admin Site
- https://grappelliproject.com/ — admin site improvements
Model
- Add created_at, updated_at
class TimeStampMixin(models.Model): created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) class Meta: abstract = True class Posts(TimeStampMixin): name = models.CharField(max_length=50) ...
API or REST
- https://github.com/axnsan12/drf-yasg — Yet Another Swagger Gen
- Tastypie - Alt to django-rest
- https://github.com/wq/django-rest-pandas — Hum looks old
GraphQL
DataLayer
Dynamic Database Connections
Dynamic Database Connections - stackoverflow
from django.db import connections # Add connection information dynamically.. connections.databases['new-alias'] = { ... } # Ensure the remaining default connection information is defined. # EDIT: this is actually performed for you in the wrapper class __getitem__ # method.. although it may be good to do it when being initially setup to # prevent runtime errors later. # connections.databases.ensure_defaults('new-alias') # Use the new connection conn = connections['new-alias']
MongoDB
- Djongo - MongoDB Django Hosting
Static files
python manage.py findstatic --verbosity 2 foo
Monitoring
Pagination
Templates
Getting URL into form
<form method='post'> {% url 'farmsync:firestoreaudit' audit.FormDataCollectionUuid as the_url %} <form action="{% the_url %}" method='post'>
Awesome Lists
- https://django.awesome-programming.com/
- https://djangotricks.blogspot.com/ — good python/js comparisons
- Oscar - Domain-driven e-commerce for Django
- https://django.awesome-programming.com/
Django Advantage of using Poetry or pdm?
- prod/dev package separation?
Monitoring
Logging
import logging logger = logging.getLogger(__name__) from celery.utils.log import get_task_logger logger = get_task_logger(__name__) import logging import os LOGLEVEL = os.environ.get('LOGLEVEL', 'WARNING').upper() logging.basicConfig(level=LOGLEVEL)