Click "raw" and grab all the markdown!
[pytest] | |
addopts = --ds=config.settings.test --reuse-db -p no:warnings | |
python_files = tests.py test_*.py |
There is nothing wrong in wanting to feed our families.
If I wanted to profit, I would stop selling digital versions of our books and only do printed versions. The last time we did that was for Two Scoops of Django 1.6, which made more than 1.5, 1.8, and 1.11 combined. That's the only way to put a halt to digital piracy: don't sell digital works. But that denies people in a lot of places access to our works. And means we're about pedagogy over profit.
We give hundreds of unpaid hours per year to open source projects. For years, every single book we've released we've given hundreds of print copies away as charity. Through books, articles, and open source contributions we have furthered people's knowledge around the world for over a decade.
All this means we're running a charity for the Python and Django community. These live classes are our means to hopefully do open source work for a living, with a few classes per month to cover our bills.
Can we make more money building apps for other people? Absolutely
# TODO: Add a comment above each line explaining what it does | |
# TODO: Add the ability to specify a game | |
# TODO: Make it so you don't have to run the script each time (while loop!) | |
# TODO: Convert this to use the Python built-in CSV library | |
from datetime import datetime | |
score = input("What score did I get? ") | |
with open("score.csv", "a") as f: | |
f.write(f"{datetime.now()}, {score}\n") |
def fun_function(name=None): | |
"""Find working ice cream promo""" | |
results = Promo.objects.active() | |
results = results.filter( | |
Q(name__startswith=name) | | |
Q(description__icontains=name) | |
) | |
results = results.exclude(status='melted') | |
results = results.select_related('flavors') | |
return results |
import sys | |
from django.core.signals import got_request_exception | |
from django.core.urlresolvers import reverse | |
from django.views.debug import technical_500_response | |
from django.utils.deprecation import MiddlewareMixin | |
class UserBasedExceptionMiddleware(MiddlewareMixin): | |
"""Allows superusers to see 500 debug pages in production""" |
ls: | |
ls -l /Library/Preferences/SystemConfiguration/ | |
backup: | |
sudo mv /Library/Preferences/SystemConfiguration/com.apple.airport.preferences.plist ~/projects/wifi-backup | |
sudo mv /Library/Preferences/SystemConfiguration/com.apple.network.eapolclient.configuration.plist ~/projects/wifi-backup | |
sudo mv /Library/Preferences/SystemConfiguration/com.apple.wifi.message-tracer.plist ~/projects/wifi-backup | |
sudo mv /Library/Preferences/SystemConfiguration/NetworkInterfaces.plist ~/projects/wifi-backup | |
sudo mv /Library/Preferences/SystemConfiguration/preferences.plist ~/projects/wifi-backup |
from django.contrib.auth.mixins import LoginRequiredMixin | |
from django.shortcuts import render, redirect | |
from django.views.generic import View | |
from asgiref.sync import sync_to_async | |
class AsyncViewMixin: | |
async def __call__(self): | |
return super().__call__(self) |
LEGALESE = """Using This Code Example | |
========================= | |
The code examples provided are provided by Daniel and Audrey Feldroy of | |
Feldroy to help you reference Django Crash Course. Code samples follow | |
PEP-0008, with exceptions made for the purposes of improving book | |
formatting. Example code is provided "as is". | |
Permissions | |
============ | |
In general, you may use the code we've provided with this book in your |
\chapter{Asynchronous Views} | |
\label{chap:asyncviews} | |
\index{Asynchronous Views|(} | |
% TODO Find ways to make trouble with async and write up how to avoid that trouble. | |
% https://docs.djangoproject.com/en/dev/topics/async/ | |
\section{Summary} | |
% TODO |