You can post a json file with curl
like so:
curl -X POST -H "Content-Type: application/json" -d @FILENAME DESTINATION
so for example:
.PHONY: all help translate test clean update compass collect rebuild | |
SETTINGS={{ project_name }}.settings | |
TEST_SETTINGS={{ project_name }}.test_settings | |
# target: all - Default target. Does nothing. | |
all: | |
@echo "Hello $(LOGNAME), nothing to do by default" | |
@echo "Try 'make help'" |
from django.core.files import File | |
from django.core.files.temp import NamedTemporaryFile | |
data = 'file' | |
file_temp = NamedTemporaryFile(delete=True, suffix='.py') | |
file_temp.write(data) | |
file_temp.flush() | |
Model.objects.create(file=File(file_temp)) |
# coding: utf-8 | |
from __future__ import absolute_import, unicode_literals | |
from collections import defaultdict | |
import commands | |
from multiprocessing import Process | |
from django.conf import settings | |
from django.core.management.base import BaseCommand |
#!/bin/bash | |
# | |
# PostgreSQL Backup Script Ver 1.0 | |
# http://autopgsqlbackup.frozenpc.net | |
# Copyright (c) 2005 Aaron Axelsen <[email protected]> | |
# | |
# This script is based of the AutoMySQLBackup Script Ver 2.2 | |
# It can be found at http://sourceforge.net/projects/automysqlbackup/ | |
# | |
# The PostgreSQL changes are based on a patch agaisnt AutoMySQLBackup 1.9 |
from django.utils.http import urlencode | |
def reverse_querystring(view, urlconf=None, args=None, kwargs=None, current_app=None, query_kwargs=None): | |
'''Custom reverse to handle query strings. | |
Usage: | |
reverse('app.views.my_view', kwargs={'pk': 123}, query_kwargs={'search': 'Bob'}) | |
''' | |
base_url = reverse(view, urlconf=urlconf, args=args, kwargs=kwargs, current_app=current_app) | |
if query_kwargs: | |
return '{}?{}'.format(base_url, urlencode(query_kwargs)) |
from rest_framework import permissions | |
class IsOwner(permissions.BasePermission): | |
""" | |
Custom permission to only allow owners of an object to edit it. | |
""" | |
def has_permission(self, request, view): | |
return request.user and request.user.is_authenticated() |
docker exec -it container-name redis-cli FLUSHALL |
# Here's your list of choices that would be displayed in a drop-down | |
# element on the web. It needs to be a tuple, and we define this | |
# as a variable just for readability/convenience. | |
# | |
# This example has 3 choices, each of which consists of two parts: | |
# 1. the thing that get strored in your database | |
# 2. the thing that you see in a dropdown list | |
LABEL_CHOICES = ( | |
('this gets stored in your database', 'This item is what you see in the drop-down'), | |
('django', 'Django'), |
sentry
SENTRY_SECRET_KEY
to random 32 char stringdocker-compose up -d
docker-compose exec sentry sentry upgrade
to setup database and create admin userdocker-compose exec sentry pip install sentry-slack
if you want slack plugin, it can be done laterdocker-compose restart sentry
9000