sudo apt-get install python3-pip
sudo pip3 install pipenv
If you have any problems with pip or pip3, edit /usr/bin/pip or /usr/bin/pip3 and change the import statement by changing
from pip import main
from django.db.models import ( | |
Avg, | |
Count, | |
DateField, | |
ExpressionWrapper, | |
F, | |
IntegerField, | |
Min, | |
Q, | |
Value |
from django.utils.functional import lazy | |
from django.utils.translation import ugettext_lazy as _ | |
from knowledge.models import Article | |
class ModeratedArticle(Article): | |
class Meta: | |
proxy = True |
sudo apt-get install putty-tools | |
# Place your keys in some directory, e.g. your home folder. Now convert the PPK keys to SSH keypairs:cache search | |
# To generate the private key: | |
puttygen your_private_key.ppk -O private-openssh -o your_new_key | |
chmod 600 your_new_key | |
# Move these keys to ~/.ssh and make sure the permissions are set to private for your private key: | |
mkdir -p ~/.ssh |
from functools import wraps | |
from django.core.cache import cache | |
from celery.five import monotonic | |
CACHE_LOCK_EXPIRE = 10 | |
import collections | |
class OrderedSet(collections.MutableSet): | |
def __init__(self, iterable=None): | |
self.end = end = [] | |
end += [None, end, end] # sentinel node for doubly linked list | |
self.map = {} # key --> [key, prev, next] | |
if iterable is not None: | |
self |= iterable |
""" | |
https://gist.github.com/Azadehkhojandi/50eaae4cf20b21faef186f2c8ee97873 | |
""" | |
import hmac | |
import hashlib | |
import binascii | |
# 1 |
sudo apt-get install python3-pip
sudo pip3 install pipenv
If you have any problems with pip or pip3, edit /usr/bin/pip or /usr/bin/pip3 and change the import statement by changing
from pip import main
location / { | |
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | |
proxy_set_header Host $http_host; | |
proxy_redirect off; | |
proxy_connect_timeout 350; | |
proxy_send_timeout 350; | |
proxy_read_timeout 350; | |
proxy_pass http://app_server; | |
location ~* ^.+\.(jpeg|jpg|png|gif|bmp|ico|svg|tif|tiff|css|js|htm|ttf|otf|webp|woff|txt|csv|rtf|doc|docx|xls|xlsx|ppt|pptx|odf|odp|ods|odt|psd|ai|eo$ | |
root /home/django/public_html; |
from django.db.models import Sum | |
class AbsoluteSum(Sum): | |
name = 'AbsoluteSum' | |
template = '%(function)s(%(absolute)s(%(expressions)s))' | |
def __init__(self, expression, **extra): | |
super(AbsoluteSum, self).__init__( | |
expression, absolute='ABS ', output_field=IntegerField(), **extra) |
# -*- coding: utf-8 -*- | |
from __future__ import absolute_import, division, print_function, unicode_literals | |
import sys | |
import os | |
import platform | |
import requests | |
import requests.exceptions | |
from requests.compat import json | |
import traceback |