Browse Source

Cambios en los directorios de datos e imágenes

politica
Celestino Rey 1 year ago
parent
commit
16507097ff
44 changed files with 253 additions and 81 deletions
  1. +1
    -5
      Libros/K8S/Makefile
  2. +9
    -9
      Libros/K8S/libros-deployment.yaml
  3. +0
    -28
      Libros/K8S/pv-local-repostajes.yaml
  4. +1
    -1
      Libros/K8S/verImg.sh
  5. +2
    -0
      Libros/biblioteca/.dockerignore
  6. +13
    -28
      Libros/biblioteca/Dockerfile
  7. +16
    -0
      Libros/biblioteca/Pipfile
  8. +172
    -0
      Libros/biblioteca/Pipfile.lock
  9. +5
    -2
      Libros/biblioteca/biblioteca/settings.py
  10. BIN
      Libros/biblioteca/datos/libros.sqlite3
  11. +3
    -0
      Libros/biblioteca/entrypoint.sh
  12. +0
    -4
      Libros/biblioteca/gestion/forms.py
  13. +25
    -2
      Libros/biblioteca/gestion/migrations/0001_initial.py
  14. BIN
      Libros/biblioteca/gestion/static/images/favicon.ico
  15. BIN
      Libros/biblioteca/gestion/static/images/favicon.png
  16. +1
    -1
      Libros/biblioteca/gestion/templates/_head.html
  17. +0
    -1
      Libros/biblioteca/gestion/templates/gestion/form_autor.html
  18. BIN
      Libros/biblioteca/libros.sqlite3
  19. BIN
      Libros/biblioteca/media/autores/220px-Yuval_Noah_Harari_cropped.jpg
  20. BIN
      Libros/biblioteca/media/autores/220px-Yuval_Noah_Harari_cropped_LijFJPx.jpg
  21. BIN
      Libros/biblioteca/media/autores/220px-Yuval_Noah_Harari_cropped_LijFJPx_g5Iu4YX.jpg
  22. BIN
      Libros/biblioteca/media/autores/auster.jpg
  23. BIN
      Libros/biblioteca/media/autores/auster_JFrSlOb.jpg
  24. BIN
      Libros/biblioteca/media/autores/auster_UR5oLPj.jpg
  25. BIN
      Libros/biblioteca/media/autores/auster_VFzZqcM.jpg
  26. BIN
      Libros/biblioteca/media/autores/auster_hjNgjmW.jpg
  27. BIN
      Libros/biblioteca/media/autores/daniel.jpg
  28. BIN
      Libros/biblioteca/media/autores/daniel_Tk9mZbV.jpg
  29. BIN
      Libros/biblioteca/media/libros/21_lecciones_para_el_siglo_XXI_-_Yuval_Noah_Harari_234.epub
  30. BIN
      Libros/biblioteca/media/libros/Palacio_de_la_Luna_El_-_Auster_Paul_99.epub
  31. BIN
      Libros/biblioteca/media/libros/Palacio_de_la_Luna_El_-_Auster_Paul_99_smWZOuv.epub
  32. BIN
      Libros/biblioteca/media/libros/Sunset_Park_-_Paul_Auster_12.epub
  33. BIN
      Libros/biblioteca/media/portadas/foto.jpeg
  34. BIN
      Libros/biblioteca/media/portadas/lecciones.jpeg
  35. BIN
      Libros/biblioteca/media/portadas/palacio.jpeg
  36. BIN
      Libros/biblioteca/media/portadas/palacio_8NDDCXJ.jpeg
  37. BIN
      Libros/biblioteca/media/portadas/sunsetpark.jpeg
  38. BIN
      Libros/biblioteca/media/profile_images/foto.jpeg
  39. BIN
      Libros/biblioteca/media/profile_images/gravatar-tino.jpeg
  40. BIN
      Libros/biblioteca/media/profile_images/gravatar-tino_HwEb5r4.jpeg
  41. BIN
      Libros/biblioteca/media/profile_images/gravatar-tino_gfVAoVx.jpeg
  42. BIN
      Libros/biblioteca/media/profile_images/nebraska.jpg
  43. BIN
      Libros/biblioteca/media/profile_images/theriver.jpg
  44. +5
    -0
      Libros/biblioteca/requirements.txt

+ 1
- 5
Libros/K8S/Makefile View File

@ -1,5 +1,4 @@
include ../servicios/.env
export IMG_VERSION = ${VERSION}
export IMG_VERSION = 1.0
# limpia todo # limpia todo
all: imagen clean install all: imagen clean install
@ -15,6 +14,3 @@ clean:
-envsubst < libros-deployment.yaml |kubectl delete -f - -envsubst < libros-deployment.yaml |kubectl delete -f -
-kubectl delete -f libros-prod-persistentvolumeclaim.yaml -kubectl delete -f libros-prod-persistentvolumeclaim.yaml
-kubectl delete -f pv-local-libros.yaml -kubectl delete -f pv-local-libros.yaml
prueba:
@echo $(VERSION)

+ 9
- 9
Libros/K8S/libros-deployment.yaml View File

@ -6,8 +6,8 @@ spec:
type: NodePort type: NodePort
ports: ports:
- name: http - name: http
port: 5000
nodePort: 30340
port: 8000
nodePort: 30343
targetPort: libros targetPort: libros
selector: selector:
app: libros app: libros
@ -31,12 +31,12 @@ spec:
app: libros app: libros
spec: spec:
containers: containers:
- args:
- gunicorn
- --bind
- 0.0.0.0:5000
- libros:create_app()
name: libros
#- args:
#- gunicorn
#- --bind
#- 0.0.0.0:5000
#- libros:create_app()
- name: libros
image: registry.reymota.es/libros:$IMG_VERSION image: registry.reymota.es/libros:$IMG_VERSION
env: env:
- name: VERSION - name: VERSION
@ -44,7 +44,7 @@ spec:
- name: ENVIRONMENT - name: ENVIRONMENT
value: "Producción" value: "Producción"
ports: ports:
- containerPort: 5000
- containerPort: 8000
name: libros name: libros
resources: {} resources: {}
volumeMounts: volumeMounts:


+ 0
- 28
Libros/K8S/pv-local-repostajes.yaml View File

@ -1,28 +0,0 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: libros-instance-folder
labels:
app: libros
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/libros/instance"
---
apiVersion: v1
kind: PersistentVolume
metadata:
name: libros-migrations-folder
labels:
app: libros
spec:
capacity:
storage: 50Mi
accessModes:
- ReadWriteOnce
hostPath:
path: "/mnt/Externo/libros/migrations"

+ 1
- 1
Libros/K8S/verImg.sh View File

@ -1 +1 @@
docker run -it creylopez/libros:1.0 bash
docker run -it registry.reymota.es/libros:1.0 bash

+ 2
- 0
Libros/biblioteca/.dockerignore View File

@ -0,0 +1,2 @@
Dockerfile
Makefile

+ 13
- 28
Libros/biblioteca/Dockerfile View File

@ -1,36 +1,21 @@
# My Django Project
# Version: 1.0
# syntax=docker/dockerfile:1
# FROM - Image to start building on.
FROM python:3
FROM python:3.8-slim-buster
WORKDIR /lyrics
# PROJECT SETUP
# ----------------
# set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# sets the working directory
WORKDIR /usr/src/django-docker
# install system dependencies
RUN apt-get update && apt-get install -y sqlite3
# copy these two files from <src> to <dest>
# <src> = current directory on host machine
# <dest> = filesystem of the container
COPY ../Pipfile* ./
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
# install pipenv on the container
RUN pip install -U pipenv
# install project dependencies
RUN pipenv install
# copy all files and directories from <src> to <dest>
COPY . . COPY . .
COPY env.produccion .env
# RUN SERVER
# ------------
# expose the port
EXPOSE 8000
# Command to run
CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"]
# run entrypoint.sh
ENTRYPOINT ["/lyrics/entrypoint.sh"]

+ 16
- 0
Libros/biblioteca/Pipfile View File

@ -0,0 +1,16 @@
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
django = "*"
djangorestframework = "*"
epub-meta = "*"
django-db = "*"
pillow = "*"
[dev-packages]
[requires]
python_version = "3.10"

+ 172
- 0
Libros/biblioteca/Pipfile.lock View File

@ -0,0 +1,172 @@
{
"_meta": {
"hash": {
"sha256": "ef4cc3e12936cd221526bb3ceae7ac1b1b7593040426b99e3ef1b167fe85abf5"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.10"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"asgiref": {
"hashes": [
"sha256:3e1e3ecc849832fe52ccf2cb6686b7a55f82bb1d6aee72a58826471390335e47",
"sha256:c343bd80a0bec947a9860adb4c432ffa7db769836c64238fc34bdc3fec84d590"
],
"markers": "python_version >= '3.8'",
"version": "==3.8.1"
},
"django": {
"hashes": [
"sha256:848a5980e8efb76eea70872fb0e4bc5e371619c70fffbe48e3e1b50b2c09455d",
"sha256:d3b811bf5371a26def053d7ee42a9df1267ef7622323fe70a601936725aa4557"
],
"index": "pypi",
"markers": "python_version >= '3.10'",
"version": "==5.1"
},
"django-db": {
"hashes": [
"sha256:8639b6f78f04f34294cb465b308992a84297df41033519efd85b3a6b186b5296"
],
"index": "pypi",
"version": "==0.0.7"
},
"djangorestframework": {
"hashes": [
"sha256:2b8871b062ba1aefc2de01f773875441a961fefbf79f5eed1e32b2f096944b20",
"sha256:36fe88cd2d6c6bec23dca9804bab2ba5517a8bb9d8f47ebc68981b56840107ad"
],
"index": "pypi",
"markers": "python_version >= '3.8'",
"version": "==3.15.2"
},
"epub-meta": {
"hashes": [
"sha256:9d9c6afeaef796105a77d0aef33a1c943ccd91cccb2cb7716f59ad149819a4e9"
],
"index": "pypi",
"version": "==0.0.7"
},
"pillow": {
"hashes": [
"sha256:02a2be69f9c9b8c1e97cf2713e789d4e398c751ecfd9967c18d0ce304efbf885",
"sha256:030abdbe43ee02e0de642aee345efa443740aa4d828bfe8e2eb11922ea6a21ea",
"sha256:06b2f7898047ae93fad74467ec3d28fe84f7831370e3c258afa533f81ef7f3df",
"sha256:0755ffd4a0c6f267cccbae2e9903d95477ca2f77c4fcf3a3a09570001856c8a5",
"sha256:0a9ec697746f268507404647e531e92889890a087e03681a3606d9b920fbee3c",
"sha256:0ae24a547e8b711ccaaf99c9ae3cd975470e1a30caa80a6aaee9a2f19c05701d",
"sha256:134ace6dc392116566980ee7436477d844520a26a4b1bd4053f6f47d096997fd",
"sha256:166c1cd4d24309b30d61f79f4a9114b7b2313d7450912277855ff5dfd7cd4a06",
"sha256:1b5dea9831a90e9d0721ec417a80d4cbd7022093ac38a568db2dd78363b00908",
"sha256:1d846aea995ad352d4bdcc847535bd56e0fd88d36829d2c90be880ef1ee4668a",
"sha256:1ef61f5dd14c300786318482456481463b9d6b91ebe5ef12f405afbba77ed0be",
"sha256:297e388da6e248c98bc4a02e018966af0c5f92dfacf5a5ca22fa01cb3179bca0",
"sha256:298478fe4f77a4408895605f3482b6cc6222c018b2ce565c2b6b9c354ac3229b",
"sha256:29dbdc4207642ea6aad70fbde1a9338753d33fb23ed6956e706936706f52dd80",
"sha256:2db98790afc70118bd0255c2eeb465e9767ecf1f3c25f9a1abb8ffc8cfd1fe0a",
"sha256:32cda9e3d601a52baccb2856b8ea1fc213c90b340c542dcef77140dfa3278a9e",
"sha256:37fb69d905be665f68f28a8bba3c6d3223c8efe1edf14cc4cfa06c241f8c81d9",
"sha256:416d3a5d0e8cfe4f27f574362435bc9bae57f679a7158e0096ad2beb427b8696",
"sha256:43efea75eb06b95d1631cb784aa40156177bf9dd5b4b03ff38979e048258bc6b",
"sha256:4b35b21b819ac1dbd1233317adeecd63495f6babf21b7b2512d244ff6c6ce309",
"sha256:4d9667937cfa347525b319ae34375c37b9ee6b525440f3ef48542fcf66f2731e",
"sha256:5161eef006d335e46895297f642341111945e2c1c899eb406882a6c61a4357ab",
"sha256:543f3dc61c18dafb755773efc89aae60d06b6596a63914107f75459cf984164d",
"sha256:551d3fd6e9dc15e4c1eb6fc4ba2b39c0c7933fa113b220057a34f4bb3268a060",
"sha256:59291fb29317122398786c2d44427bbd1a6d7ff54017075b22be9d21aa59bd8d",
"sha256:5b001114dd152cfd6b23befeb28d7aee43553e2402c9f159807bf55f33af8a8d",
"sha256:5b4815f2e65b30f5fbae9dfffa8636d992d49705723fe86a3661806e069352d4",
"sha256:5dc6761a6efc781e6a1544206f22c80c3af4c8cf461206d46a1e6006e4429ff3",
"sha256:5e84b6cc6a4a3d76c153a6b19270b3526a5a8ed6b09501d3af891daa2a9de7d6",
"sha256:6209bb41dc692ddfee4942517c19ee81b86c864b626dbfca272ec0f7cff5d9fb",
"sha256:673655af3eadf4df6b5457033f086e90299fdd7a47983a13827acf7459c15d94",
"sha256:6c762a5b0997f5659a5ef2266abc1d8851ad7749ad9a6a5506eb23d314e4f46b",
"sha256:7086cc1d5eebb91ad24ded9f58bec6c688e9f0ed7eb3dbbf1e4800280a896496",
"sha256:73664fe514b34c8f02452ffb73b7a92c6774e39a647087f83d67f010eb9a0cf0",
"sha256:76a911dfe51a36041f2e756b00f96ed84677cdeb75d25c767f296c1c1eda1319",
"sha256:780c072c2e11c9b2c7ca37f9a2ee8ba66f44367ac3e5c7832afcfe5104fd6d1b",
"sha256:7928ecbf1ece13956b95d9cbcfc77137652b02763ba384d9ab508099a2eca856",
"sha256:7970285ab628a3779aecc35823296a7869f889b8329c16ad5a71e4901a3dc4ef",
"sha256:7a8d4bade9952ea9a77d0c3e49cbd8b2890a399422258a77f357b9cc9be8d680",
"sha256:7c1ee6f42250df403c5f103cbd2768a28fe1a0ea1f0f03fe151c8741e1469c8b",
"sha256:7dfecdbad5c301d7b5bde160150b4db4c659cee2b69589705b6f8a0c509d9f42",
"sha256:812f7342b0eee081eaec84d91423d1b4650bb9828eb53d8511bcef8ce5aecf1e",
"sha256:866b6942a92f56300012f5fbac71f2d610312ee65e22f1aa2609e491284e5597",
"sha256:86dcb5a1eb778d8b25659d5e4341269e8590ad6b4e8b44d9f4b07f8d136c414a",
"sha256:87dd88ded2e6d74d31e1e0a99a726a6765cda32d00ba72dc37f0651f306daaa8",
"sha256:8bc1a764ed8c957a2e9cacf97c8b2b053b70307cf2996aafd70e91a082e70df3",
"sha256:8d4d5063501b6dd4024b8ac2f04962d661222d120381272deea52e3fc52d3736",
"sha256:8f0aef4ef59694b12cadee839e2ba6afeab89c0f39a3adc02ed51d109117b8da",
"sha256:930044bb7679ab003b14023138b50181899da3f25de50e9dbee23b61b4de2126",
"sha256:950be4d8ba92aca4b2bb0741285a46bfae3ca699ef913ec8416c1b78eadd64cd",
"sha256:961a7293b2457b405967af9c77dcaa43cc1a8cd50d23c532e62d48ab6cdd56f5",
"sha256:9b885f89040bb8c4a1573566bbb2f44f5c505ef6e74cec7ab9068c900047f04b",
"sha256:9f4727572e2918acaa9077c919cbbeb73bd2b3ebcfe033b72f858fc9fbef0026",
"sha256:a02364621fe369e06200d4a16558e056fe2805d3468350df3aef21e00d26214b",
"sha256:a985e028fc183bf12a77a8bbf36318db4238a3ded7fa9df1b9a133f1cb79f8fc",
"sha256:ac1452d2fbe4978c2eec89fb5a23b8387aba707ac72810d9490118817d9c0b46",
"sha256:b15e02e9bb4c21e39876698abf233c8c579127986f8207200bc8a8f6bb27acf2",
"sha256:b2724fdb354a868ddf9a880cb84d102da914e99119211ef7ecbdc613b8c96b3c",
"sha256:bbc527b519bd3aa9d7f429d152fea69f9ad37c95f0b02aebddff592688998abe",
"sha256:bcd5e41a859bf2e84fdc42f4edb7d9aba0a13d29a2abadccafad99de3feff984",
"sha256:bd2880a07482090a3bcb01f4265f1936a903d70bc740bfcb1fd4e8a2ffe5cf5a",
"sha256:bee197b30783295d2eb680b311af15a20a8b24024a19c3a26431ff83eb8d1f70",
"sha256:bf2342ac639c4cf38799a44950bbc2dfcb685f052b9e262f446482afaf4bffca",
"sha256:c76e5786951e72ed3686e122d14c5d7012f16c8303a674d18cdcd6d89557fc5b",
"sha256:cbed61494057c0f83b83eb3a310f0bf774b09513307c434d4366ed64f4128a91",
"sha256:cfdd747216947628af7b259d274771d84db2268ca062dd5faf373639d00113a3",
"sha256:d7480af14364494365e89d6fddc510a13e5a2c3584cb19ef65415ca57252fb84",
"sha256:dbc6ae66518ab3c5847659e9988c3b60dc94ffb48ef9168656e0019a93dbf8a1",
"sha256:dc3e2db6ba09ffd7d02ae9141cfa0ae23393ee7687248d46a7507b75d610f4f5",
"sha256:dfe91cb65544a1321e631e696759491ae04a2ea11d36715eca01ce07284738be",
"sha256:e4d49b85c4348ea0b31ea63bc75a9f3857869174e2bf17e7aba02945cd218e6f",
"sha256:e4db64794ccdf6cb83a59d73405f63adbe2a1887012e308828596100a0b2f6cc",
"sha256:e553cad5179a66ba15bb18b353a19020e73a7921296a7979c4a2b7f6a5cd57f9",
"sha256:e88d5e6ad0d026fba7bdab8c3f225a69f063f116462c49892b0149e21b6c0a0e",
"sha256:ecd85a8d3e79cd7158dec1c9e5808e821feea088e2f69a974db5edf84dc53141",
"sha256:f5b92f4d70791b4a67157321c4e8225d60b119c5cc9aee8ecf153aace4aad4ef",
"sha256:f5f0c3e969c8f12dd2bb7e0b15d5c468b51e5017e01e2e867335c81903046a22",
"sha256:f7baece4ce06bade126fb84b8af1c33439a76d8a6fd818970215e0560ca28c27",
"sha256:ff25afb18123cea58a591ea0244b92eb1e61a1fd497bf6d6384f09bc3262ec3e",
"sha256:ff337c552345e95702c5fde3158acb0625111017d0e5f24bf3acdb9cc16b90d1"
],
"index": "pypi",
"markers": "python_version >= '3.8'",
"version": "==10.4.0"
},
"pymysql": {
"hashes": [
"sha256:4de15da4c61dc132f4fb9ab763063e693d521a80fd0e87943b9a453dd4c19d6c",
"sha256:e127611aaf2b417403c60bf4dc570124aeb4a57f5f37b8e95ae399a42f904cd0"
],
"markers": "python_version >= '3.7'",
"version": "==1.1.1"
},
"sqlparse": {
"hashes": [
"sha256:773dcbf9a5ab44a090f3441e2180efe2560220203dc2f8c0b0fa141e18b505e4",
"sha256:bb6b4df465655ef332548e24f08e205afc81b9ab86cb1c45657a7ff173a3a00e"
],
"markers": "python_version >= '3.8'",
"version": "==0.5.1"
},
"typing-extensions": {
"hashes": [
"sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d",
"sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"
],
"markers": "python_version < '3.11'",
"version": "==4.12.2"
}
},
"develop": {}
}

+ 5
- 2
Libros/biblioteca/biblioteca/settings.py View File

@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/5.0/ref/settings/
""" """
from pathlib import Path from pathlib import Path
import os
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@ -78,10 +79,10 @@ WSGI_APPLICATION = 'biblioteca.wsgi.application'
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'libros.sqlite3',
'NAME': os.path.join(BASE_DIR, 'datos/libros.sqlite3'),
} }
} }
print("DB:",DATABASES)
# Password validation # Password validation
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators # https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
@ -129,3 +130,5 @@ LOGIN_REDIRECT_URL = 'principal'
LOGOUT_REDIRECT_URL = 'principal' LOGOUT_REDIRECT_URL = 'principal'
AUTH_USER_MODEL = "gestion.ReyMotaUser" AUTH_USER_MODEL = "gestion.ReyMotaUser"
MEDIA_ROOT = os.path.join(BASE_DIR, 'media/') # 'media' is my media folder

BIN
Libros/biblioteca/datos/libros.sqlite3 View File


+ 3
- 0
Libros/biblioteca/entrypoint.sh View File

@ -0,0 +1,3 @@
#!/bin/bash
exec "$@"

+ 0
- 4
Libros/biblioteca/gestion/forms.py View File

@ -10,7 +10,6 @@ class AutorForm(forms.ModelForm):
nombre = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'})) nombre = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
biografia = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'})) biografia = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
foto = forms.FileField(widget=forms.TextInput(attrs={'class': 'form-control', 'type': 'file'}))
class LibroForm(forms.ModelForm): class LibroForm(forms.ModelForm):
class Meta: class Meta:
@ -18,10 +17,7 @@ class LibroForm(forms.ModelForm):
fields = ['titulo', 'autor', 'fecha_publicacion', 'descripcion', 'archivo', 'portada'] fields = ['titulo', 'autor', 'fecha_publicacion', 'descripcion', 'archivo', 'portada']
titulo = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'})) titulo = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
# fecha_publicacion = forms.DateField(widget=forms.TextInput(attrs={'class': 'form-control'}))
descripcion = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'})) descripcion = forms.CharField(widget=forms.TextInput(attrs={'class': 'form-control'}))
# archivo = forms.FileField(widget=forms.TextInput(attrs={'class': 'form-control', 'type': 'file'}))
portada = forms.FileField(widget=forms.TextInput(attrs={'class': 'form-control', 'type': 'file'}))
autor = forms.ModelChoiceField( autor = forms.ModelChoiceField(
queryset=Autor.objects.all(), queryset=Autor.objects.all(),


+ 25
- 2
Libros/biblioteca/gestion/migrations/0001_initial.py View File

@ -1,4 +1,4 @@
# Generated by Django 5.0.7 on 2024-08-09 09:07
# Generated by Django 5.1 on 2024-08-13 12:55
import django.core.validators import django.core.validators
import django.db.models.deletion import django.db.models.deletion
@ -15,6 +15,15 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.CreateModel(
name='Autor',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('nombre', models.CharField(max_length=200)),
('biografia', models.TextField(blank=True, null=True)),
('foto', models.ImageField(blank=True, null=True, upload_to='autores/')),
],
),
migrations.CreateModel( migrations.CreateModel(
name='ReyMotaUser', name='ReyMotaUser',
fields=[ fields=[
@ -24,6 +33,9 @@ class Migration(migrations.Migration):
('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')), ('is_superuser', models.BooleanField(default=False, help_text='Designates that this user has all permissions without explicitly assigning them.', verbose_name='superuser status')),
('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')), ('email', models.EmailField(max_length=254, unique=True, verbose_name='email address')),
('foto', models.ImageField(blank=True, upload_to='profile_images')), ('foto', models.ImageField(blank=True, upload_to='profile_images')),
('is_staff', models.BooleanField(default=False)),
('is_active', models.BooleanField(default=True)),
('nombre', models.CharField(blank=True, max_length=200, null=True)),
('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')), ('groups', models.ManyToManyField(blank=True, help_text='The groups this user belongs to. A user will get all permissions granted to each of their groups.', related_name='user_set', related_query_name='user', to='auth.group', verbose_name='groups')),
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')), ('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.permission', verbose_name='user permissions')),
], ],
@ -31,5 +43,16 @@ class Migration(migrations.Migration):
'abstract': False, 'abstract': False,
}, },
), ),
migrations.CreateModel(
name='Libro',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('titulo', models.CharField(max_length=200)),
('fecha_publicacion', models.PositiveBigIntegerField(default=2024, validators=[django.core.validators.MinValueValidator(1984), gestion.models.max_value_current_year])),
('descripcion', models.TextField(blank=True, null=True)),
('archivo', models.FileField(upload_to='libros/')),
('portada', models.ImageField(blank=True, null=True, upload_to='portadas/')),
('autor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gestion.autor')),
],
),
] ]

BIN
Libros/biblioteca/gestion/static/images/favicon.ico View File

Before After

BIN
Libros/biblioteca/gestion/static/images/favicon.png View File

Before After
Width: 32  |  Height: 32  |  Size: 1.7 KiB

+ 1
- 1
Libros/biblioteca/gestion/templates/_head.html View File

@ -12,7 +12,7 @@
<meta name="description" content="Portal - Bootstrap 5 Admin Dashboard Template For Developers"> <meta name="description" content="Portal - Bootstrap 5 Admin Dashboard Template For Developers">
<meta name="author" content="Xiaoying Riley at 3rd Wave Media"> <meta name="author" content="Xiaoying Riley at 3rd Wave Media">
<link rel="shortcut icon" href="favicon.ico">
<link rel="shortcut icon" href="{% static 'images/favicon.ico' %}">
<!-- FontAwesome JS--> <!-- FontAwesome JS-->
<script defer src="{% static 'plugins/fontawesome/js/all.min.js' %}"></script> <script defer src="{% static 'plugins/fontawesome/js/all.min.js' %}"></script>


+ 0
- 1
Libros/biblioteca/gestion/templates/gestion/form_autor.html View File

@ -5,7 +5,6 @@
<h3>{% if form.instance.pk %}Editar Autor{% else %}Nuevo Autor{% endif %}</h3> <h3>{% if form.instance.pk %}Editar Autor{% else %}Nuevo Autor{% endif %}</h3>
<div class="box"> <div class="box">
<form method="POST" enctype="multipart/form-data"> <form method="POST" enctype="multipart/form-data">
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}


BIN
Libros/biblioteca/libros.sqlite3 View File


BIN
Libros/biblioteca/media/autores/220px-Yuval_Noah_Harari_cropped.jpg View File

Before After
Width: 220  |  Height: 259  |  Size: 13 KiB

BIN
Libros/biblioteca/media/autores/220px-Yuval_Noah_Harari_cropped_LijFJPx.jpg View File

Before After
Width: 220  |  Height: 259  |  Size: 13 KiB

BIN
Libros/biblioteca/media/autores/220px-Yuval_Noah_Harari_cropped_LijFJPx_g5Iu4YX.jpg View File

Before After
Width: 220  |  Height: 259  |  Size: 13 KiB

BIN
Libros/biblioteca/media/autores/auster.jpg View File

Before After
Width: 300  |  Height: 300  |  Size: 38 KiB

BIN
Libros/biblioteca/media/autores/auster_JFrSlOb.jpg View File

Before After
Width: 300  |  Height: 300  |  Size: 38 KiB

BIN
Libros/biblioteca/media/autores/auster_UR5oLPj.jpg View File

Before After
Width: 300  |  Height: 300  |  Size: 38 KiB

BIN
Libros/biblioteca/media/autores/auster_VFzZqcM.jpg View File

Before After
Width: 300  |  Height: 300  |  Size: 38 KiB

BIN
Libros/biblioteca/media/autores/auster_hjNgjmW.jpg View File

Before After
Width: 300  |  Height: 300  |  Size: 38 KiB

BIN
Libros/biblioteca/media/autores/daniel.jpg View File

Before After
Width: 959  |  Height: 1280  |  Size: 65 KiB

BIN
Libros/biblioteca/media/autores/daniel_Tk9mZbV.jpg View File

Before After
Width: 959  |  Height: 1280  |  Size: 65 KiB

BIN
Libros/biblioteca/media/libros/21_lecciones_para_el_siglo_XXI_-_Yuval_Noah_Harari_234.epub View File


BIN
Libros/biblioteca/media/libros/Palacio_de_la_Luna_El_-_Auster_Paul_99.epub View File


BIN
Libros/biblioteca/media/libros/Palacio_de_la_Luna_El_-_Auster_Paul_99_smWZOuv.epub View File


BIN
Libros/biblioteca/media/libros/Sunset_Park_-_Paul_Auster_12.epub View File


BIN
Libros/biblioteca/media/portadas/foto.jpeg View File

Before After
Width: 150  |  Height: 148  |  Size: 3.0 KiB

BIN
Libros/biblioteca/media/portadas/lecciones.jpeg View File

Before After
Width: 488  |  Height: 751  |  Size: 32 KiB

BIN
Libros/biblioteca/media/portadas/palacio.jpeg View File

Before After
Width: 337  |  Height: 500  |  Size: 36 KiB

BIN
Libros/biblioteca/media/portadas/palacio_8NDDCXJ.jpeg View File

Before After
Width: 337  |  Height: 500  |  Size: 36 KiB

BIN
Libros/biblioteca/media/portadas/sunsetpark.jpeg View File

Before After
Width: 533  |  Height: 800  |  Size: 242 KiB

BIN
Libros/biblioteca/media/profile_images/foto.jpeg View File

Before After
Width: 150  |  Height: 148  |  Size: 3.0 KiB

BIN
Libros/biblioteca/media/profile_images/gravatar-tino.jpeg View File

Before After
Width: 256  |  Height: 256  |  Size: 29 KiB

BIN
Libros/biblioteca/media/profile_images/gravatar-tino_HwEb5r4.jpeg View File

Before After
Width: 256  |  Height: 256  |  Size: 29 KiB

BIN
Libros/biblioteca/media/profile_images/gravatar-tino_gfVAoVx.jpeg View File

Before After
Width: 256  |  Height: 256  |  Size: 29 KiB

BIN
Libros/biblioteca/media/profile_images/nebraska.jpg View File

Before After
Width: 320  |  Height: 320  |  Size: 34 KiB

BIN
Libros/biblioteca/media/profile_images/theriver.jpg View File

Before After
Width: 320  |  Height: 320  |  Size: 34 KiB

+ 5
- 0
Libros/biblioteca/requirements.txt View File

@ -0,0 +1,5 @@
asgiref==3.8.1
Django==5.1
pillow==10.4.0
sqlparse==0.5.1
typing_extensions==4.12.2

Loading…
Cancel
Save