This file contains hidden or 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
# 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. |
This file contains hidden or 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
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) |
This file contains hidden or 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
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 |
This file contains hidden or 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.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), |
This file contains hidden or 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
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 |
This file contains hidden or 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
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 | |
This file contains hidden or 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
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". |
This file contains hidden or 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
# 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 |
This file contains hidden or 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
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 |
This file contains hidden or 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
# docker-compose.yml | |
version: "3.3" | |
services: | |
database: | |
container_name: touristspots_database | |
image: postgis/postgis | |
restart: always | |
volumes: |