Что делать если команда работает не во всех директориях?
echo $PATH
/usr/local/bin
/usr/local/sbin
Не нужно ничего копировать в PATH, это плохой совет. Пусть лежит там, где положено.
Просто создайте для eww symlink в /usr/local/bin
Еще более красивый механизм - использовать механизм alternatives https://ru.wikipedia.org/wiki/Alternatives
Пример - бинарнику нужны библиотеки, которые лежат рядом и при копировании он их перестанет видеть.
Или в скрипте установки зашит путь и при обновлении версии новый бинарник опять ляжет в оригинальную директорию.
Проблема с Aiogram что делать?
@router.message(Command('me'))
async def get_me(message: Message):
await get_me(message)
Что нужно писать в строке «Объект»?
cd ~/your-project-directory
mv env.example .env
ping: cannot resolve http://somesite.test/: Unknown host
ping http://somesite.test/
ping somesite.test
docker run --rm --add-host somesite.test:10.10.0.8 httpd ab -c 3 -n 20 somesite.test
cat docker-compose.yml
version: "3"
services:
nginx-server:
image: nginx
restart: always
ports:
- "8000:80"
volumes:
- ./src:/usr/share/nginx/html
networks:
default:
aliases:
- www.google.com
- bober.kurwa.pl
client:
restart: always
image: nginx
docker exec -ti tmp-client-1 /usr/bin/ping bober.kurwa.pl
3. В папке /backups должно храниться 5 копий, самую старую копию надо стереть после удачной заливки
- block:
- name: Determine old directories
set_fact:
old_dirs: "{{ (install_artifacts.files|sort(attribute='mtime', reverse=True))[3:] }}"
- name: Remove old directories
file:
path: "{{ item.path }}"
state: absent
with_items: "{{ old_dirs }}"
when: install_artifacts.matched > 3
After each test, Django calls flush to reset the database state. This empties all tables and emits the post_migrate signal, which recreates one content type and four permissions for each model. This operation gets expensive proportionally to the number of models.
Setting reset_sequences = True on a TransactionTestCase will make sure sequences are always reset before the test run
class TestsThatDependsOnPrimaryKeySequences(TransactionTestCase):
reset_sequences = True
def test_animal_pk(self):
lion = Animal.objects.create(name="lion", sound="roar")
# lion.pk is guaranteed to always be 1
self.assertEqual(lion.pk, 1)
url_ = f"{reverse("products")}"/add?pk_order={order_pk}&pk_repairer={i[0]}"
# settings.py
YOUR_SITE_BASE_URL = os.getenv('YOUR_SITE_BASE_URL')
from django.conf import settings
url_ = f"{settings.YOUR_SITE_BASE_URL}/add?pk_order={order_pk}&pk_repairer={i[0]}"
Updater
The sole purpose of this class now is to fetch updates from Telegram. It now only accepts the arguments bot and update_queue and only has those attributes.
Сработает ли подключение через hdmi-сплиттер (один hdmi-вход - два hdmi-выхода)?
А вот АБСОЛЮТНО правильный код:
player = tkvideo ("25fps.mp4",my_label, loop = 1, size = (1280,720))
player = tkvideo.tkvideo("C:\\path\\to\\video.mp4", my_label, loop = 1, size = (1280,720))
C:\python310\
@receiver(post_save, sender=User)
def create_or_update_user_profile(sender, instance, created, **kwargs):
if created:
Profile.objects.create(user=instance)
# тут если надо что-то делаем с моделью
instance.profile.save()