Skip to content

Instantly share code, notes, and snippets.

View EdisonArango's full-sized avatar
:shipit:

Edison Arango EdisonArango

:shipit:
View GitHub Profile
import re
import fileinput
import os, fnmatch
import glob
from pathlib import Path
# https://stackoverflow.com/questions/41571281/easy-way-to-set-on-delete-across-entire-application
# https://stackoverflow.com/questions/11898998/how-can-i-write-a-regex-which-matches-non-greedy

First server

List volumes

docker volume ls

Inspect volume

docker volume inspect 

Production Checklist

  • Create droplet
  • Create and attach volume to the droplet
  • Docker compose config for production
  • Docker compose restart policies
  • Point docker volumes to Digital Ocean volume
  • Passwords creation and management using environmen variables or .env file
  • Django settings for production using environment variables
  • Disable DEBUG mode

Utility commands

Generate distribution tarball

python setup.py sdist

Installing a distribution from tarball

pip install my_tarball.tar.gz

General

print() and logger.debug() does not the logs in the console, either use logger.info(), logger.warning(), logger.error()

Celery

Always check the init.py file of the app that initializes celery, it MUST contain this:

Otherwise tasks uses infinite time 😫