<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>
{% block title %}
Главная
{% endblock %}
</title>
</head>
<body>
{% if user.is_authenticated %}
<div>
<nav>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">Выйти</button>
</form>
</li>
</ul>
</div>
</nav>
</div>
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% else %}
<div>
<nav>
<div>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% endif %}
{% block content %}
{% endblock %}
</body>
</html>
{% extends 'forum/base.html' %}
{% block title %}
Новый пост
{% endblock %}
{% block content %}
{% if user.is_authenticated %}
<h1>Напишите свой пост</h1>
<form action="{% url 'add_post' %}" method="post">
{% csrf_token %}
<div>
<label><input name="title" placeholder="Заголовок..." /></label>
</div>
<div>
<label><textarea name="description" placeholder="Текст поста..."></textarea></label>
</div>
<div>
<input type="submit" />
</div>
</form>
{% else %}
<h1>Вы не авторизованы</h1>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
{% endif %}
{% endblock %}
pip install python-magic
>>> import magic
>>> magic.from_file("testdata/test.pdf")
'PDF document, version 1.2'
# recommend using at least the first 2048 bytes, as less can produce incorrect identification
>>> magic.from_buffer(open("testdata/test.pdf", "rb").read(2048))
'PDF document, version 1.2'
>>> magic.from_file("testdata/test.pdf", mime=True)
'application/pdf'
запустить ос камеры на пкэто не возможно. Возможно подключить к пк и запустить программу на странице 45.
slug_field¶
The name of the field on the model that contains the slug. By default, slug_field is 'slug'.
slug_url_kwarg¶
The name of the URLConf keyword argument that contains the slug. By default, slug_url_kwarg is 'slug'.
urlpatterns = [ path("<slug:slug>/", ArticleDetailView.as_view(), name="article-detail"), ]
Error: Failed to load module @rollup/rollup-win32-x64-msvc. Required DLL was not found. This error usually happens when Microsoft Visual C++ Redistributable is not installed. You can download it from https://aka.ms/vs/17/release/vc_redist.x64.exe
import requests
base_url = "https://www.ursus.ru/catalogue/zashchita_ot_padeniy_s_vysoty/page-"
pages = 8
for i in range(1, pages + 1):
print(f"Page: {i}")
print(f"{base_url}{i}/")
requests.get(f"{base_url}{i}.")
headers = {
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)\
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36"
}
data = requests.get(url, headers=headers)
import requests
from bs4 import BeautifulSoup
url = "https://realt.by/sale-flats/object/2562548/"
headers = {
"User-Agent": "Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N)\
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Mobile Safari/537.36"
}
data = requests.get(url, headers=headers)
soup = BeautifulSoup(data.text, features="html.parser")
img = (
soup.find("div", attrs={"class": "swiper-wrapper"})
.findAll("img", class_="blur-sm scale-105")[1]
.get("src")
)
print(img)
https://static.realt.by/thumb/c/600x400/6f57b1d409f96f2b1ede7f082f120b50/ja/e/site15nf8eja/7c30f38145.jpg
Open a new command prompt as administrator.
Type the following command:net stop dps
. Hit the Enter key.
Now, execute the following command:del /F /S /Q /A "%windir%\System32\sru\*
".
Finally, execute the commandnet start dps