Skip to content

Instantly share code, notes, and snippets.

View sti-munene's full-sized avatar
🥉
Finessing this thing called Code!

Stephen Kinyua Munene sti-munene

🥉
Finessing this thing called Code!
View GitHub Profile
@sti-munene
sti-munene / Django_Channels3_Custom_Auth_Middleware.py
Created April 30, 2022 10:06 — forked from AliRn76/Django_Channels3_Custom_Auth_Middleware.py
Token authorization middleware for Django Channels 3
from django.contrib.auth.models import AnonymousUser
from rest_framework.authtoken.models import Token
from channels.db import database_sync_to_async
from channels.middleware import BaseMiddleware
from project.settings import SIMPLE_JWT, SECRET_KEY
@database_sync_to_async
def get_user(token_key):
# If you are using normal token based authentication
try:
@sti-munene
sti-munene / django_deploy.md
Created July 10, 2021 12:43 — forked from bradtraversy/django_deploy.md
Django Deployment - Digital Ocean

Django Deployment to Ubuntu 18.04

In this guide I will go through all the steps to create a VPS, secure it and deploy a Django application. This is a summarized document from this digital ocean doc

Any commands with "$" at the beginning run on your local machine and any "#" run when logged into the server

Create A Digital Ocean Droplet

Use this link and get $10 free. Just select the $5 plan unless this a production app.