TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #411 · 9 фев.

reload_flag="" if [[ -n "${DEBUG}" ]]; then reload_flag="--reload" fi if [[ -n "${WORKER_COUNT}" ]]; then workers=${WORKER_COUNT} else workers=2 fi gunicorn --workers ${workers} \ --bind 0.0.0.0:8000 \ ${reload_flag} main.wsgi Писали такие конструкции чтобы проверить наличие флага и сформировать команду правильно? На самом деле можно сделать тоже самое проще. Для этого используются операторы условной подстановки, доступные в оболочках семейства POSIX. :- для установки значений по умолчанию ${WORKER_COUNT:-2} Если переменная не объявлена, то будет дефолтное значение 2. :+ подставляет указанный текст, если переменная не пуста ${DEBUG:+--reload} Если что-то есть в переменной то распечатается текст после символа +, в противном случае - ничего. Удобно для опциональных флагов, как в нашем примере. Итого наш скрипт может выглядеть так: gunicorn --workers ${WORKER_COUNT:-2} \ --bind 0.0.0.0:8000 \ ${DEBUG:+--reload} main.wsgi Есть еще два оператора. := не только подставить дефолтное значение, но и присвоить его переменной, если она пуста # никаких переменных еще нет VAL1=${VAL2:=hello} # теперь доступны обе echo $VAL1 $VAL2 # hello hello :? остановить выполнение с ошибкой, если переменной нет. echo ${MISS:?is required} bash: MISS: is required Код выхода будет 1. #tricks#linux

Резултати

Пронајдени 3 слични објави

Пребарај: #permissions

当前筛选 #permissions清除筛选
djangoproject

@djangoproject · Post #440 · 13.09.2017 г., 14:50

Using the Django authentication system This document explains the usage of Django’s #authentication system in its default configuration. This configuration has evolved to serve the most common project needs, handling a reasonably wide range of tasks, and has a careful implementation of #passwords and #permissions. For projects where authentication needs differ from the default, #Django supports extensive extension and customization of authentication. https://docs.djangoproject.com/es/1.11/topics/auth/default/

djangoproject

@djangoproject · Post #441 · 13.09.2017 г., 14:56

User authentication in #Django Django comes with a user authentication system. It handles user #accounts, #groups, #permissions and #cookie-based user #sessions. This section of the documentation explains how the default implementation works out of the box, as well as how to extend and customize it to suit your project’s needs. https://docs.djangoproject.com/es/1.11/topics/auth/

GitHub Trends

@githubtrending · Post #14663 · 02.05.2025 г., 12:30

#python#agents#ai#ai_agents#api#developer_tools#function_calling#integration#llm#mcp#oauth2#open_source#permissions#tools ACI.dev is an open-source platform that helps build AI agents by providing easy access to over 600 tools. It simplifies authentication and tool integration, allowing AI agents to work with many services like Google Calendar and Slack without needing separate setups. This platform offers multi-tenant authentication, flexible access methods, and natural language permissions, making it easier to manage and secure AI agent capabilities. It's open-source and works with any framework, which means you can build AI agents without worrying about vendor lock-in. https://github.com/aipotheosis-labs/aci