# coding:utf-8 | |
import gc | |
import inspect | |
import weakref | |
from django.core.management.base import BaseCommand, CommandError | |
from django.dispatch import Signal | |
REF_TYPES = (weakref.ReferenceType,) |
import OpenGL.GL as GL | |
import OpenGL.GL.shaders | |
import ctypes | |
import pygame | |
import numpy | |
vertex_shader = """ | |
#version 330 | |
in vec4 position; |
class CaptureQueries(object): | |
""" | |
Context manager that captures queries executed by the specified connection. | |
Mostly copied from django.test.utils.CaptureQueriesContext. | |
""" | |
def __init__(self, connection = None): | |
if connection is None: | |
from django import db | |
connection = db.connection | |
Generally, you will add a git remote for your Heroku app during the Heroku app creation process, i.e. heroku create
. However, if you are working on an existing app and want to add git remotes to enable manual deploys, the following commands may be useful.
Note that on Heroku, you must always use master
as the destination branch on the remote. If you want to deploy a different branch, you can use the syntax local_branch:destination_branch
seen below (in this example, we push the local staging
branch to the master
branch on heroku.
$ git remote add staging https://git.heroku.com/staging-app.git
The only way I've succeeded so far is to employ SSH.
Assuming you are new to this like me, first I'd like to share with you that your Mac has a SSH config
file in a .ssh
directory. The config
file is where you draw relations of your SSH keys to each GitHub (or Bitbucket) account, and all your SSH keys generated are saved into .ssh
directory by default. You can navigate to it by running cd ~/.ssh
within your terminal, open the config
file with any editor, and it should look something like this:
Host * AddKeysToAgent yes
> UseKeyChain yes
from channels.auth import AuthMiddlewareStack | |
from rest_framework.authtoken.models import Token | |
from django.contrib.auth.models import AnonymousUser | |
from django.db import close_old_connections | |
class TokenAuthMiddleware: | |
""" | |
Token authorization middleware for Django Channels 2 | |
""" |
Here is a short guide that will help you setup your environment to create signed commits
or signed tags
with Git locally. This has been extensively tested on Windows with Git and the Github Desktop application: I use it every day for my professional development projects.
I you face any issue, feel free to leave a comment below.
def patch_geos_signatures(): | |
""" | |
Patch GEOS to function on macOS arm64 and presumably | |
other odd architectures by ensuring that call signatures | |
are explicit, and that Django 4 bugfixes are backported. | |
Should work on Django 2.2+, minimally tested, caveat emptor. | |
""" | |
import logging |