
For protecting data in views from anonymous users you need to use authenticating system. Django provides built-in functions for auth implementation (documentation).
What is authentication? Authentication - process of user identification data comparison. Authentication passes in two steps:
- User identification - searching in database entered username.
- Authentication. If username from first step exists, system comparing value from "password" field in HTML page with password, saved …
#authentication #backend #django #django-view #login #password #python #username

Why exactly Docker compose? Docker compose used when you want to run your applications on any machine and start it by one click. This way called as serverless and cross platform architecture. Docker allow you to run applications on any computer, where it installed. It's very convenient and simple.
Complete structure of project:
demo_project/
|
|-- manage.py
|
|-- env/
|
|-- backend/
&n…
#backend #database #devops #django #docker #example #linux #nginx #postgresql #python

Django SECRET_KEY need for providing cryptographic signing (documentation). This value is stored in <your_app>/settings.py file. When you start new project it will be generated from built-in function (source code). For production deployment SECRET_KEY must be strong and reliably protected.
These steps help you for generating new SECRET_KEY value:
1. Activate your project's virtual environment:
source env/bin/activate
2. Enter in Django's manage.py shell:
python3 manage.py shell
3. Import get_ra…
#backend #configuration #django #python #secret-key #security #settings

Telegram provides API for sending messages to users from bot. You may send messages via HTTP POST method using any programming language. I use Python and Requests library.
The URL address for sending message (require HTTP POST method):
https://api.telegram.org/bot<token_from_botfather>/sendMessage
Body of message:
{
"chat_id": 123,
"text": "Hello World!"
}
If you want to markup your message with Markdown - add parse_mode parameter in body of JSON:
{
 …
#api #bot #document #http #http-requests #https #json #message #python #telegram #telegram-bot

Hardcoding tokens, database credentials and other sensitive data in .py files is not secure. Many people use django-environ library, but I think it inconvenient. So I use yaml files for storing sensitive data and pyyaml library for reading data of them.
Create project folder:
mkdir myproject
Switch in created folder:
cd myproject
Create virtual environment:
python3 -m venv env
Activate virtual environment:
source env/bin/activate
Install Django and pyyaml:
pip3 install django pyyaml
Start new Django proje…
#backend #django #python #pyyaml #security #yaml

# Docker overview
Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker's methodologies for shipping, testing, and deploying code, you can significantly reduce the delay between writing code and running it in production. Documentation.
# Ba…
#cheat-sheet #docker #linux

Sending HTTP requests to WEB-server with self-signed certificate from Python Requests library may display in terminal some warnings. The most popular warning is: «InsecureRequestWarning: Unverified HTTPS request». Don't worry, it's just a warning. But if you want disable it, follow this tutorial.
Output example with self-signed certificate:
/usr/lib/python3/dist-packages/urllib3/connectionpool.py:1048: InsecureRequestWarning: Unverified HTTPS request is being made to host '192.168.0.150'. Adding …
#http #http-requests #https #python #ssl #ssl-certificate #troubleshooting

After we're figured out the setup cron jobs in operating system, it's time to learn how to run any scripts in Docker container.
Create folder with your project's name and create there four text files with following names:
myproject/
- my_script.py
- cronjob
- Dockerfile
- docker-compose.yaml
File my_script.py need for run periodically. It may contain any code for your job. For example:
import requests
r = requests.get(url='https://example.com/')
if r.status_code == 200:
&…
#bash-script #cron #devops #docker #dockerfile #linux #python-script #script

Допустим тебе надоело работать кассиром в Макдоналдсе, и ты решил ворваться в сферу информационных технологий «с ноги».
Что для этого нужно:
- Усидчивость;
- Терпение;
- Умение пользоваться «Гуглом»;
- Убрать в сторону всякие «не хочу», «не буду».
Что нужно изучать? Все советуют выбрать направление и начинать учиться по нему. Я же скажу что, независимо от выбранного направления, ты должен изучить «базу». Иначе ты становишься хирургом, не знающим анатомию! Не важно, будешь ты инженером по аппаратному …
#it #для-самых-маленьких

- Configuring Cisco firewall in Linux machine with Minicom
-> Configuring network access with Cisco ASA via minicom utility
Configuring Cisco ASA 5500-series as network gateway and share internet access to users through local area network (LAN) with DHCP and DNS.
CIsco devices have three mode in command line interface:
- First mode after you connected to device is unprivileged mode. This mode allows only monitoring and you can't modify running configurations.
- Second mode - privileged, allows c…
#cisco #debian #firewall #internet #linux #network #routing #ubuntu