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 слични објави

Пребарај: #odoo

当前筛选 #odoo清除筛选
GitHub Trends

@githubtrending · Post #14646 · 30.04.2025 г., 11:30

#python#erp#hacktoberfest#odoo#python These tools are for Odoo administrators to improve technical features. They include modules like **attachment queue**, **auto backup**, and **audit log**, which help manage files, secure data, and track changes. Other modules like **sentry** and **server action logging** help monitor errors and server actions. These tools make Odoo more efficient and easier to manage, providing benefits like better data security and improved system performance. https://github.com/OCA/server-tools

GitHub Trends

@githubtrending · Post #15378 · 31.12.2025 г., 11:30

#javascript#erp#hacktoberfest#odoo#python OCA/web offers 40+ free addons for Odoo 18 web interface, like dark mode, responsive design, custom calendars, notifications, charts, and tree view improvements with maintainers listed. All pass pre-commit, build, and translation checks, licensed AGPL-3.0 or per module. You gain easy UI enhancements to customize Odoo backend faster, boost usability on mobile/touchscreens, save time on exports/filters, and improve productivity without coding from scratch. https://github.com/OCA/web

GitHub Trends

@githubtrending · Post #14951 · 12.07.2025 г., 12:00

#python#apps#business#erp#management#odoo#odoo_apps#python Odoo is a powerful, open-source business software that combines many tools like CRM, website building, eCommerce, inventory, accounting, and more into one easy-to-use platform. You can pick and choose only the apps you need, making it flexible and cost-effective. It helps you manage all parts of your business in one place, improving efficiency, reducing errors, and giving you real-time data for better decisions. Its user-friendly design means your team can learn it quickly, and it grows with your business as you add more features. This saves you time, cuts costs, and boosts productivity. https://github.com/odoo/odoo