
Emacs keymap extension for Visual Studio Code
Awesome Emacs Keymap (emacs-mcx)

Emacs keymap extension for Visual Studio Code
Awesome Emacs Keymap (emacs-mcx)

A Wedge of Django: Covers Python 3.8 and Django 3.x
We also get some points from this book…
['Abc', 2, 'Fine', 3, 4]
{
'a1': 'Model A',
'B3': 'Color 1',
'coffee': 'cafe',
}
<p>{{ my_statement }}</p>DATABASES = {
# Raises ImproperlyConfigured Exception
# if DATABASE_URL Not in os.environ
"default": env.db(
"DATABASE_URL", default="postgres://db_username:password@127.0.0.1:5432/db_name",
)
}
<p>{{ object.bio|linebreaksbr }}<p>x = 1
#if condition returns True, then nothing happens:
assert x == 1
#if condition returns False, AssertionError is raised:
assert x == 2
from django.http import HttpResponse
from django.views.generic import View
class MyView(View):
def get(self, request, *args, **kwargs):
return HttpResponse('Response to GET request')
def post(self, request, *args, **kwargs):
return HttpResponse('Response to POST request')
def delete(self, request, *args, **kwargs):
return HttpResponse('Response to DELETE request')
def my_view(request, *args, **kwargs):
if request.method == 'POST':
return HttpResponse('Response POST request')
elif request.method == 'DELETE':
return HttpResponse('Response DELETE request')
return HttpResponse('Response GET request')
def my_view(request, *args, **kwargs):
METHOD_DISPATCH = {
'POST': HttpResponse('Response POST request'),
'DELETE': HttpResponse('Response DELETE request'),
}
DEFAULT = HttpResponse('Response GET request')
return METHOD_DISPATCH.get(request.method, DEFAULT)
To be continued…
Readings:
บล็อกของ phyblas
Qiita (@phyblas)
django-braces’s documentation
Class-based View
What is a REPL?
How to configure your Django project for multiple environments?
Deploy A Django Project
Deploying a Django application in Windows with Apache and mod_wsgi
How to Remove Services in Windows 10
Anaconda + Django + Apache Webserver
How to run Django on Apache using Windows 10, Virtualenv Python and mod_wsgi
Manage your Python Virtual Environment with Conda
Deploying Django on Windows Server 2019 and Apache with MOD_WSGI
Just bought this book from feldroy.com.

GitHub for Two-Scoop-of-Django-3.x
Key Points:
from django.db.models import CharField as ModelCharField
from django.forms import CharField as FormCharField
patterns = [
path(route='add/',
view=views.add_topping,
name='toppings:add_topping'),
]
yourprojname_reporoot #This is the <repository_root>.
|--config/
| |--settings/
| |--__init__.py
| |--asgi.py| |--urls.py
| |--wsgi.py
|--docs/
|--yourprojname_project/ #The <django_project_root> of the project.
| |--media/ #development only!
| |--apps1/
| |--apps2/
| |--apps3/
| |--static/ #Non-user-generated static media assets (CSS, JavaScript, and images).
| |--templates/ #Your site-wide Django templates
|--.gitignore
|--Makefile
|--README.md
|--manage.py
|--requirements.txt #Current dependencies ($ pip freeze > requirements.txt)
apps1/
|--api/
|--models.py
|--services.py #Service layer location for business logic
|--selectors.py #Service layer location for queries
|--tests/
settings/
|--__init__.py
|--base.py #Settings common to all instances of the project.
|--local.py #Settings file when working on the project locally.
|--staging.py #Staging version for running a semi-private version of the site on a production server.
|--test.py #Settings for running tests including test runners, in-memory database definitions, and log settings.
|--production.py #Settings file used by your live production server(s). Sometimes called prod.py.
python manage.py shell --settings=config.settings.local
python manage.py runserver --settings=config.settings.local
To be continued…
Further readings:
The Twelve-Factor App
PEP8 — Style Guide for Python Code