The first thing to do is to install Git on the remote server.
Once you do that the rest of the process is split into three sections:
- Server set-up
- Local set-up (push commits)
- Server (pull commits)
from celery import Task | |
from celery.task import task | |
from my_app.models import FailedTask | |
from django.db import models | |
@task(base=LogErrorsTask) | |
def some task(): | |
return result | |
class LogErrorsTask(Task): |
class TransactionsList(ListAPIView): | |
""" | |
List all transactions for currently logged in user, paginated by 25 | |
page -- page number | |
ordering -- yoddle_amount, created, yoddle_description, reverse order ie. -yoddle_amount | |
""" | |
model = Transaction |
<?php | |
// See: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html | |
// Start a session (which should use cookies over HTTP only). | |
session_start(); | |
// Create a new CSRF token. | |
if (! isset($_SESSION['csrf_token'])) { | |
$_SESSION['csrf_token'] = base64_encode(openssl_random_pseudo_bytes(32)); | |
} |
""" User Django Rest Framework to check to see if an authenticated user | |
is in a particular group | |
Usage:: | |
from api.group_permissions import GroupAPIGETPermission | |
class SearchProductView(View): | |
permissions = (IsAuthenticated, GroupAPIGETPermission,) |
from types import MethodType | |
from django.http import CompatCookie, HttpRequest | |
def _set_cookie(self, key, value='', max_age=None, expires=None, path='/', | |
domain=None, secure=False): | |
self._resp_cookies[key] = value | |
self.COOKIES[key] = value | |
if max_age is not None: |