This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Django settings for myproject project. | |
DEBUG = True | |
TEMPLATE_DEBUG = DEBUG | |
ADMINS = ( | |
# ('Your Name', 'your_email@example.com'), | |
) | |
MANAGERS = ADMINS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
execute_js( | |
library_list, | |
main_function, | |
data_dict={}, | |
callbacks={}, | |
css_list=[], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Установка ссылки на библиотеку D3: | |
d3_lib_url = "https://d3js.org/d3.v3.min.js" | |
# Определение JavaScript-функции при помощи Python-строки: | |
js_string = “”” | |
function draw_circle(div_id, data){ | |
d3.select(div_id) | |
.append("div") | |
.style("width", "50px") | |
.style("height", "50px") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Указание ссылки на библиотеку D3: | |
d3_lib_url = "https://d3js.org/d3.v3.min.js" | |
# Загрузка локальных библиотек: | |
with open("radial_bar.css", "r") as f: | |
radial_bar_css = f.read() | |
with open ("radial_bar_lib.js", "r") as f: | |
radial_bar_lib = f.read() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
helloworld_js = """ | |
function helloworld(div_id, data){ | |
comm = new CommAPI("get_hello", (ret) => { | |
document.querySelector(div_id).textContent = ret.text; | |
}); | |
setInterval(() => {comm.call({})}, 1000); | |
comm.call({}); | |
} | |
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
def hello_world_random(data): | |
hello_world_languages = [ | |
"Ola Mundo", # Португальский | |
"Hello World", # Английский | |
"Hola Mundo", # Испанский | |
"Geiá sou Kósme", # Греческий | |
"Kon'nichiwa sekai", # Японский | |
"Hallo Welt", # Немецкий | |
"namaste duniya" # Хинди |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from notebookjs import execute_js | |
execute_js(helloworld_js, "helloworld", callbacks={"get_hello": hello_world_random}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<article class ="main-article"> | |
<h1> Титаник(1997) </h1> | |
<p class ="plot" > 84 года спустя... </p> | |
<div class ="full-script"> | |
"13 метров. Можешь сам посмотреть. " | |
<br> | |
"Хорошо, поднимите её и перекиньте через носовой поручень. " | |
<br> | |
... | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from bs4 import BeautifulSoup | |
import requests | |
root = 'https://subslikescript.com' | |
website = f'{root}/movies' | |
result = requests.get(website) | |
content = result.text | |
soup = BeautifulSoup(content, 'lxml') | |
box = soup.find('article', class_='main-article') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ExampleMiddleware: | |
def _init_(self, get_response): | |
self.get_response = get_response | |
def _call_(self, request): | |
# Код, вызываемый перед представлением при каждом запросе. | |
response = self.get_response(request) |
OlderNewer