- MetadataFileField.generate_filename: substitutes a UUID for the original
filename in the upload_to path so new files land at a stable, unguessable
storage path (e.g. sapl/public/norma/2025/9395/<uuid>.pdf). For
replacements the existing UUID is reused; OverwriteStorage replaces bytes
in-place and the public /documentos/<uuid>/ URL never changes. A fresh UUID
is stashed on the instance (_pending_uuid_<field>) and wired into the new
FileMetadata row in pre_save so FileMetadata.uuid always matches the path.
- pre_save Case 2 fix: skip explicit default_storage.delete() when old and new
storage paths are identical (UUID-based replacement) to avoid deleting the
freshly written file that OverwriteStorage already placed at that path.
- MetadataFileFieldSerializer: overrides to_representation only (inherits
DRF FileField for writes) to emit /documentos/<uuid>/ for API responses
instead of the semantic alias .url() returns. SaplSerializerMixin wires it
in via build_standard_field while preserving all normal field kwargs.
- nginx sapl.conf: adds `internal` and `etag on` to /media/ so clients can no
longer fetch files directly; only Django's X-Accel-Redirect reaches the
location.
- settings.py: adds ConditionalGetMiddleware after CommonMiddleware to set
ETag and Last-Modified on Django responses and short-circuit with 304.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* Adiciona dDocker baseado em Alpine-Python3 com Ngnix e Gunicorn
* Atualiza docker-compose com gunicorn, ngnix e postgres
* Ajusta gitignore para ignorar postgres-data
* Adiciona script bash para conexao ao banco
* Ajusta busy-wait.sh script para sincronizar o banco(postgres) com a aplicação django no docker
* Add alias to sapldb
* Refazer Dockerfile
* Ajusta Dockerfile e docker-compose com entrypoint start.sh
* Ajusta start.sh
* Adiciona mais pontos de montagem.
* Coloca start.sh como executável: chmod +x start.sh
* Remove arquivo lixo
* Substitui gen-env.py por shell script puro
* Ajusta diretorio /var/interlegis/sapl e collect_static como volume no nginix
* Simplifica criação de diretórios.
* Adiciona ponto de montagem em postgres para importar dados
* Adiciona mais parâmetros de ambiente UNIX para entrypoint docker
* Adiciona Docker baseado em Alpine-Python3 com Ngnix e Gunicorn
* Atualiza docker-compose com gunicorn, ngnix e postgres
* Ajusta gitignore para ignorar postgres-data
* Adiciona script bash para conexao ao banco
* Ajusta busy-wait.sh script para sincronizar o banco(postgres) com a aplicação django no docker
* Add alias to sapldb