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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>AdminLTE 3 Dashboard</title> | |
<!-- AdminLTE CSS --> |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>My Folium Map</title> | |
<!-- Importa o arquivo CSS do Leaflet --> | |
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css" integrity="sha256-p4NxAoJBhIIN+hmNHrzRCf9tD/miZyoHS5obTRR9BMY=" crossorigin=""/> | |
<!-- Importa o arquivo JavaScript do Leaflet --> | |
<script src="https://unpkg.com/[email protected]/dist/leaflet.js" integrity="sha256-20nQCchB9co0qIjJZRGuk2/Z9VM+kNiyxNV1lvTlZBo=" crossorigin=""></script> |
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
# models.py | |
from django.db import models | |
class MinhaTabela(models.Model): | |
campo1 = models.CharField(max_length=50) | |
campo2 = models.CharField(max_length=50) | |
class Meta: | |
managed = False | |
db_table = 'NOME_DA_TABELA_ORACLE' # Defina o nome da tabela no banco de dados Oracle |
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 collections import namedtuple | |
Local = namedtuple('Local', ['nome', 'latitude', 'longitude']) | |
locais = [ | |
Local('Estátua da Liberdade, Nova York, EUA', 40.6892, -74.0445), | |
Local('Torre Eiffel, Paris, França', 48.8584, 2.2945), | |
Local('Opera House, Sydney, Austrália', -33.8568, 151.2153), | |
Local('Cristo Redentor, Rio de Janeiro, Brasil', -22.9519, -43.2105), | |
Local('Pirâmides de Gizé, Cairo, Egito', 29.9792, 31.1342), |
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
# pip install paramiko | |
import paramiko | |
address = '10.0.0.61' | |
username = 'root' | |
password = 'pythondevops' | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) |
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
ESTADOS_CHOICES = [ | |
['AC', 'Acre'], | |
['AL', 'Alagoas'], | |
['AP', 'Amapá'], | |
['AM', 'Amazonas'], | |
['BA', 'Bahia'], | |
['CE', 'Ceará'], | |
['ES', 'Espírito Santo'], | |
['GO', 'Goiás'], | |
['MA', 'Maranhão'], |
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 json | |
with open('posts.json') as f: | |
posts_json = json.load(f) | |
for post in posts_json: | |
title = post['title'] | |
content = post['content'] | |
author_id = post['user_id'] | |
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
#models.py | |
from django.db import models | |
from django.contrib.auth.models import User | |
from PIL import Image | |
class Profile(models.Model): | |
user = models.OneToOneField(User, on_delete=models.CASCADE) | |
image = models.ImageField(default='default.jpg', upload_to='profile_pics') |
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
#forms.py | |
from django import forms | |
from django.contrib.auth.models import User | |
from django.contrib.auth.forms import UserCreationForm | |
from .models import Profile | |
class UserRegisterForm(UserCreationForm): | |
email = forms.EmailField() | |
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
#urls.py | |
from django.urls import path | |
from .views import PostListView | |
from .views import PostDetailView | |
from .views import PostCreateView | |
from .views import PostUpdateView | |
from .views import PostDeleteView | |
from . import views |
NewerOlder