Skip to content

Instantly share code, notes, and snippets.

View alisonamerico's full-sized avatar
🐍
💻 Working from 🏠

Alison Américo alisonamerico

🐍
💻 Working from 🏠
  • Recife, Brasil
View GitHub Profile
# api/models.py
class Picture(models.Model):
picture_url = models.ImageField(upload_to='pic_folder/', default='pic_folder/none/no-img.jpg')
tourist_spot = models.ForeignKey('TouristSpot', on_delete=models.CASCADE)
class TouristSpot(models.Model):
"""
This class contains the representation of the fields in the TouristSpot table.
Descrição:
Uma **Demanda de Peças** é composta por:
Descrição da peça que está sendo solicitada
Endereço de Entrega (considere que estamos trabalhando no Brasil)
Informações de Contato
Anunciante (Usuário Dono)
Status de Finalização (Aberta ou Finalizada)
@alisonamerico
alisonamerico / erro_username_facebook.txt
Created July 28, 2020 21:07
erro_username_facebook
snowman on  112 [!?] is 📦 v0.1.0 via 🐍 v3.8.3 took 4m9s
❯ docker-compose up
Starting touristspots_database ... done
Starting snowman_web_1 ... done
Attaching to touristspots_database, snowman_web_1
touristspots_database |
touristspots_database | PostgreSQL Database directory appears to contain a database; Skipping initialization
touristspots_database |
touristspots_database | 2020-07-28 21:02:43.291 UTC [1] LOG: starting PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
touristspots_database | 2020-07-28 21:02:43.292 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
@alisonamerico
alisonamerico / login_facebook.txt
Last active July 28, 2020 19:06
loginfacebook
# urls.py
from django.contrib import admin
from django.urls import include, path
from rest_framework.authtoken.views import obtain_auth_token
from touristspots.api.views import FacebookLogin
urlpatterns = [
path('admin/', admin.site.urls),
@alisonamerico
alisonamerico / gist:d858bd52caf996d7ba590513e7972be9
Created July 26, 2020 00:50
erro_ao_instalar_lib_gdal_via_poetry
snowman on  84 [!?] is 📦 v0.1.0 via 🐍 v3.8.3 (.venv)
❯ poetry add gdal
Using version ^3.1.2 for gdal
Updating dependencies
Resolving dependencies...
Writing lock file
snowman on  84 is 📦 v0.1.0 via 🐍 v3.8.3 (.venv) took 4s
❯ poetry add gdal
Using version ^3.1.2 for gdal
Updating dependencies
Resolving dependencies... (2.3s)
Writing lock file
snowman on  80 [!?] is 📦 v0.1.0 via 🐍 v3.8.3 took 10m44s
❯ docker-compose up
Creating touristspots_database ... done
Creating snowman_web_1 ... done
Attaching to touristspots_database, snowman_web_1
touristspots_database | The files belonging to this database system will be owned by user "postgres".
touristspots_database | This user must also own the server process.
touristspots_database |
touristspots_database | The database cluster will be initialized with locale "C.UTF-8".
touristspots_database | The default database encoding has accordingly been set to "UTF8".
# Dockerfile
# Pull base image
FROM python:3.8.5-buster
# python
# Set environment variables
ENV PYTHONUNBUFFERED 1
# prevents python creating .pyc files
ENV PYTHONDONTWRITEBYTECODE=1
snowman on  80 [!?] is 📦 v0.1.0 via 🐍 v3.8.3 took 3m24s
❯ docker-compose build
database uses an image, skipping
Building web
Step 1/18 : FROM python:3.8.5-buster
---> 3189819ced3e
Step 2/18 : ENV PYTHONUNBUFFERED 1
---> Using cache
---> 28dfe31ef636
Step 3/18 : ENV PYTHONDONTWRITEBYTECODE=1
# docker-compose.yml
version: "3.3"
services:
database:
container_name: touristspots_database
image: postgis/postgis
restart: always
volumes: