Rodando sua aplicação Django em um ambiente distribuído com wsgid e mongrel2
Nessa palestra você conhecerá duas novas ferramentas que facilitarão o deploy de suas aplicações Django em um abiente distribuído.
TF_LOG=DEBUG t plan | |
2024-02-16T14:35:44.883-0300 [INFO] Terraform version: 1.7.3 | |
2024-02-16T14:35:44.884-0300 [DEBUG] using github.com/hashicorp/go-tfe v1.41.0 | |
2024-02-16T14:35:44.884-0300 [DEBUG] using github.com/hashicorp/hcl/v2 v2.19.1 | |
2024-02-16T14:35:44.884-0300 [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1 | |
2024-02-16T14:35:44.884-0300 [DEBUG] using github.com/zclconf/go-cty v1.14.1 | |
2024-02-16T14:35:44.884-0300 [INFO] Go runtime version: go1.21.5 | |
2024-02-16T14:35:44.884-0300 [INFO] CLI args: []string{"terraform", "plan"} | |
2024-02-16T14:35:44.884-0300 [DEBUG] Attempting to open CLI config file: /home/***/.terraformrc | |
2024-02-16T14:35:44.884-0300 [DEBUG] File doesn't exist, but doesn't need to. Ignoring. |
from aiohttp import web | |
from asyncworker import App | |
from asyncworker.http.types import PathParam | |
app = App() | |
@app.http.get(["/path/{_bool}/{string}/{number}/{_float}"]) | |
async def user_books(_bool: PathParam[bool], string: PathParam[str]): |
from aiohttp.web import Request, json_response | |
from pydantic import BaseModel | |
from asyncworker import App, RouteTypes | |
from asyncworker.routes import call_http_handler | |
app = App() | |
class UserResource(BaseModel): |
import asyncio | |
from typing import Dict, Type, Any, Callable, get_type_hints, Coroutine, TypeVar | |
T = TypeVar("T") | |
types_registry: Dict[Type, Any] = dict() | |
async def call_func( | |
f: Callable[..., Coroutine[Any, Any, T]], registry: Dict[Type, Any] | |
) -> T: |
class LoggerProxy(object): | |
def _setup_logger(self, logger): | |
console = logging.StreamHandler() | |
logger.addHandler(console) | |
logger.setLevel(logging.INFO) | |
logger._configured = True |
import mock | |
class AlmostAlwaysTrue(object): | |
def __init__(self, total_iterations=1): | |
self.total_iterations = total_iterations | |
self.current_iteration = 0 | |
def __nonzero__(self): | |
if self.current_iteration < self.total_iterations: |
# Requires clint (https://github.com/kennethreitz/clint) from the develop branch, because of the expected_size argument. | |
def download(url, to_file, chunk_size=8192): | |
r = requests.get(url) | |
size = int(r.headers['Content-Length']) | |
expected_size = size / chunk_size | |
with open(to_file, 'w') as f: | |
for chunk in progress.bar(r.iter_content(chunk_size=chunk_size), expected_size=expected_size): |
import sys | |
users = {} | |
for line in sys.stdin: | |
username = line.strip('\n') | |
if username not in users: | |
users[username] = 1 | |
else: |
#!/usr/bin/env python | |
def requires_apikey(f): | |
def wrap(req, *args, **kwargs): | |
print "Searching fot an API Key inside {0}...".format(req) | |
return f(req, *args, **kwargs) | |
return wrap | |