- Run the following command to create a kubectlproxy service file.
sudo nano /lib/systemd/system/kubectlproxy.service- Copy these contents into your file and save.
[Unit]
| package session | |
| import ( | |
| "context" | |
| "encoding/base32" | |
| "errors" | |
| "log" | |
| "net/http" | |
| "strings" | |
| "time" |
| """ | |
| Converts Models.TextChoices to TypeScript Const. | |
| Primarily used for Select Fields | |
| Example: | |
| Input: | |
| class JobFunctionChoices(models.TextChoices): | |
| MANAGER = "MANAGER", _("Manager") |
| """ | |
| Converts Django models to TypeScript types. | |
| Example: | |
| Input: | |
| class JobTitle(GenericModel): | |
| name = models.CharField( | |
| _("Name"), | |
| max_length=100, |
sudo nano /lib/systemd/system/kubectlproxy.service[Unit]
| class ClogGenericAPIView(viewsets.ViewSet): | |
| """ | |
| Generic API View for CLOG use this class for any redundant logic. | |
| """ | |
| model = None | |
| serializer = None | |
| def list(self, request): | |
| queryset = self.model.objects.all() # Or you could do a selector instead of model | |
| serializer = self.serializer(queryset, many=True) |
| from django.utils.translation import gettext_lazy as _ # Import this bad boy | |
| class Organization(TimeStampedModel): | |
| """ | |
| Organization Model Fields | |
| """ |
| import time | |
| def main(): | |
| """Print the latest tutorial from Real Python""" | |
| tic = time.perf_counter() | |
| # code here | |
| toc = time.perf_counter() |
| # Prints SQL statements to console. Put this in your settings.py | |
| LOGGING = { | |
| 'version': 1, | |
| 'filters': { | |
| 'require_debug_true': { | |
| '()': 'django.utils.log.RequireDebugTrue', | |
| } | |
| }, | |
| 'handlers': { |
| async function getChargeType(charge_id) { | |
| // Charge Type API GET request | |
| let url = "/api/charge_types/" + charge_id + "/"; | |
| // Await the response of the fetch call | |
| const response = await fetch(url, { | |
| method: 'GET', | |
| headers: { | |
| 'Content-Type': 'application/json', | |
| 'Authorization': 'Token ' + window.localStorage.getItem('token'), |
| # Core Django Imports | |
| from django.db.models.base import ModelBase | |
| from django.contrib.auth import get_user_model | |
| from django.contrib.auth.backends import BaseBackend | |
| from django.contrib.auth.base_user import AbstractBaseUser | |
| # Monta Imports | |
| from monta_user.models import MontaUser |