Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extraida lib para gestão de arquivos no s3 para lib devpro-s3-storages #34

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading