View default
# full nginx conf for Django w/web-sockets
upstream app_server {
server fail_timeout=0;
upstream websocket {
server fail_timeout=0;
# place file in static root
from django.views.generic.base import RedirectView
from import staticfiles_storage
urlpatterns = [
url(r'C798C4F2FDD57D2D63BF76874C080F49.txt', RedirectView.as_view(
View django
upstream app_server {
server fail_timeout=0;
upstream websocket {
server fail_timeout=0;
#server {
# listen 80;
View gunicorn.conf
# gunicorn.conf
description "Gunicorn app server for Django Project"
start on runlevel [2345]
stop on runlevel [!2345]
setuid username
setgid www-data
View websockets.html
<!DOCTYPE html>
<html lang="en" dir="ltr" class="no-js">
<script language="javascript" type="text/javascript">
var wsUri = "wss://";
var output;
View cli.txt
# view all running processes
ps aux
# kill a process
sudo kill <PID>
# edit SSH keys
cd ~/.ssh
nano authorized_keys
View nginx.conf
# /etc/nginx/nginx.conf
# `gzip` Settings
gzip on;
gzip_disable "msie6";
gzip_vary on;
View httpd-app.conf
# need to add the below or DRF will throw auth errors
WSGIPassAuthorization On
View pycharm-venv.txt
# Reminder for me! How to configure PyCharm to use venv
- create virtual env as per usual via command line
- PyCharm > Preferences > Project / Project Interp.
- click cog > Add Local & and select Python from within local project bin
- Done!
from itertools import chain
from operator import attrgetter
group1_queryset = group1.objects.all() or filter()
group2_queryset = group2.objects.all() or filter()
result = sorted(
    chain(group1_queryset, group2_queryset),