defects = db.relationship('Defect', backref=db.backref('author', lazy=True), lazy=True)
While lazy-loading a relationship is fast, it can easily become a major bottleneck when you end up triggering extra queries in a loop for more than a few objects. For this case, SQLAlchemy lets you override the loading strategy on the query level. If you wanted a single query to load all categories and their posts, you could do it like this:
В django связи работают легко и непринужденно, здесь же я лопачу интернет уже который час
Допустим есть строка '\x3e\x1f\x2c', именно строка, типа str
s = r'\x3e\x1f\x2c\x1f-\x2f\x2c\x3c'
print(s)
if s.find('\\x1f-\\x2f') != -1:
print('совпало')
if '\\x1f-\\x2f' in s:
print('совпало')
Нужно найти в ней \x1f-\x2f
\\x[1|2]{1}[a-c|f]{1}
re.findall(r'\\x[1|2]{1}[a-c|f]{1}',s)
['\\x1f', '\\x2c', '\\x1f', '\\x2f', '\\x2c']
docker run -it --rm -p 192.168.0.100:80:80 debian bash
try:
1/0
except Exception:
print('произошла ошибка, ну и пофиг')
# 0 is too far from ` ;)
set -g base-index 1
setw -g mode-keys vi
#remove escape delay
set -sg escape-time 0
# remap prefix from 'C-b' to 'C-a'
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# kill session
# bind-key k kill-session
# last window ctrl+a
bind-key C-a last-window
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# Enable mouse mode (tmux 2.1 and above)
# set -g mouse on
# don't rename windows automatically
# set-option -g allow-rename off
# resize
bind-key -r J resize-pane -D 5
bind-key -r K resize-pane -U 5
bind-key -r H resize-pane -L 5
bind-key -r L resize-pane -R 5
# switch panes
bind-key j select-pane -D
bind-key k select-pane -U
bind-key h select-pane -L
bind-key l select-pane -R
# pane movement
bind-key a command-prompt -p "join pane from:" "join-pane -s '%%'"
bind-key s command-prompt -p "send pane to:" "join-pane -t '%%'"
# Reload tmux config
bind r source-file ~/.tmux.conf
# THEME
set -g default-terminal "screen-256color"
set -g status-bg black
set -g status-fg white
set -g window-status-current-bg white
set -g window-status-current-fg black
set -g window-status-current-attr bold
set -g status-interval 60
set -g status-left-length 30
set -g status-left '#[fg=green](#S) #(whoami)@#H'
set -g status-right '#[fg=yellow]#(cut -d " " -f 1-3 /proc/loadavg)#[default] #[fg=white]%H:%M#[default]'
set -g status-justify centre
set -ga terminal-overrides ',*:sitm@,ritm@'