Skip to content

Commit

Permalink
Extraida lib para gestão de arquivos no s3 para lib devpro-s3-storages
Browse files Browse the repository at this point in the history
close #32
  • Loading branch information
renzo authored and renzon committed Sep 5, 2024
1 parent e2c5362 commit 9bc08da
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 82 deletions.
8 changes: 1 addition & 7 deletions backend/devpro/base/admin.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
from django.contrib import admin
from django.contrib.admin import ModelAdmin
from django_min_custom_user.admin import MinUserAdmin

from devpro.base.models import User, Arquivo
from devpro.base.models import User


@admin.register(User)
class UserAdmin(MinUserAdmin):
pass


@admin.register(Arquivo)
class ArquivoAdmin(ModelAdmin):
pass
21 changes: 0 additions & 21 deletions backend/devpro/base/migrations/0002_arquivo.py

This file was deleted.

6 changes: 0 additions & 6 deletions backend/devpro/base/models.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
from django.db import models
from django_min_custom_user.models import MinAbstractUser


class User(MinAbstractUser):
pass


class Arquivo(models.Model):
arq = models.FileField(upload_to='public/')
privado = models.FileField(upload_to='private/')
40 changes: 0 additions & 40 deletions backend/devpro/s3_file_handlers.py

This file was deleted.

6 changes: 3 additions & 3 deletions backend/devpro/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
"""

from pathlib import Path
from decouple import config, Csv

import dj_database_url
from decouple import config, Csv

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
Expand Down Expand Up @@ -134,7 +134,7 @@
# Muda a configuração de upload de arquivos locais para bater com produção
STORAGES = {
"default": {
"BACKEND": "devpro.s3_file_handlers.FileSystemWithValidationStorage",
"BACKEND": "devpro_s3_storages.handlers.FileSystemWithValidationStorage",
},
"staticfiles": {
"BACKEND": "django.contrib.staticfiles.storage.StaticFilesStorage",
Expand All @@ -147,7 +147,7 @@
AWS_S3_SECRET_ACCESS_KEY = config('AWS_S3_SECRET_ACCESS_KEY')
STORAGES = {
"default": {
"BACKEND": "devpro.s3_file_handlers.S3FileStorage",
"BACKEND": "devpro_s3_storages.handlers.S3FileStorage",
"OPTIONS": {
'default_acl': 'private',
'location': 'media',
Expand Down
25 changes: 20 additions & 5 deletions backend/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ python-decouple = "^3.8"
django-min-custom-user = "^0.2.0"
django-storages = {extras = ["s3"], version = "^1.14.4"}
pillow = "^10.4.0"
devpro-s3-storages = "^0.1.0"


[tool.poetry.group.dev]
Expand Down

0 comments on commit 9bc08da

Please sign in to comment.