Skip to content

Instantly share code, notes, and snippets.

@tamhv
tamhv / migrations.md
Created December 4, 2024 09:04 — forked from majackson/migrations.md
Django migrations without downtime

Django Migrations without Downtime

The following instructions describe a set of processes allowing you to run Django database migrations against a production database without having to bring the web service down.

Note that in the below instructions, migrations are all run manually at explicit points, and are not an automatic part of the deployment process.

Adding Fields or Tables

Adding a (nullable) field or a new table

  1. Make the model or column addition in your code.
@tamhv
tamhv / gist:d11204b2c4224f4f0b03ba9aa422a40c
Created November 26, 2018 09:34
centos 7 docker container connect to host on port 443
sudo firewall-cmd --add-service=https --permanent
sudo firewall-cmd --reload
@tamhv
tamhv / redux.js
Created March 21, 2018 02:36
reset redux state by action
# delete all state alter log out
const appReducer = combineReducers({
todos,
visibilityFilter
});
const rootReducer = ( state, action ) => {
if ( action.type === LOG_OUT ) {
state = undefined;
}
@tamhv
tamhv / settings.py
Created November 3, 2017 10:18
celery django test config
# celery==4.1.0
# django==1.11.x
# execute task synchronous
CELERY_TASK_ALWAYS_EAGER = True
# raise exception in task
CELERY_TASK_EAGER_PROPAGATES = True