diff --git a/Dockerfile b/Dockerfile index 3cc001e..5d05940 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,6 +21,7 @@ ENV APP_HOME=/home/app/web RUN mkdir $APP_HOME WORKDIR $APP_HOME RUN mkdir $APP_HOME/staticfiles +RUN mkdir $APP_HOME/uploadsfiles USER root # set environment variables diff --git a/bookCafe/settings.py b/bookCafe/settings.py index 478d676..3fa792f 100644 --- a/bookCafe/settings.py +++ b/bookCafe/settings.py @@ -125,8 +125,8 @@ # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/4.0/howto/static-files/ STATIC_URL = 'static/' -MEDIA_URL = '/' -MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads') +MEDIA_URL = 'media/' +MEDIA_ROOT = os.path.join(BASE_DIR, 'uploadsfiles') STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') STATICFILES_DIRS = [ BASE_DIR / "dist", diff --git a/bookCafe/urls.py b/bookCafe/urls.py index 962432d..8348e2d 100644 --- a/bookCafe/urls.py +++ b/bookCafe/urls.py @@ -23,3 +23,5 @@ path('', include('findBookCafe.urls')), ]+ static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) +handler404 = 'findBookCafe.views.page404' +handler500 = 'findBookCafe.views.page500' \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e25ca2e..d5ddfce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,6 +6,7 @@ services: command: gunicorn bookCafe.wsgi:application --bind 0.0.0.0:8000 volumes: - static_volume:/home/app/web/staticfiles + - uploads_volume:/home/app/web/uploadsfiles - ./db.sqlite3:/home/app/web/db.sqlite3 expose: - 8000 @@ -17,6 +18,7 @@ services: build: ./nginx volumes: - static_volume:/home/app/web/staticfiles + - uploads_volume:/home/app/web/uploadsfiles depends_on: - web hostname: cafe-book-nginx @@ -26,6 +28,7 @@ services: volumes: static_volume: + uploads_volume: networks: nginx: diff --git a/findBookCafe/models.py b/findBookCafe/models.py index 38e047f..4b6f64a 100644 --- a/findBookCafe/models.py +++ b/findBookCafe/models.py @@ -1,3 +1,4 @@ +from cProfile import label from random import choices from django.db import models from django_quill.fields import QuillField @@ -36,6 +37,7 @@ class Shop(models.Model): type = models.CharField(choices=CAFE_TYPES_OPTIONS, max_length=3, default=CAFE_TYPES_OPTIONS[0]) thumbnail = models.ImageField(upload_to ='uploads/', null = True) name = models.CharField(max_length=300) + name_en = models.CharField(max_length=300) latitude = models.FloatField(max_length=100) longitude = models.FloatField(max_length=100) address = models.CharField(max_length=300) @@ -46,6 +48,7 @@ class Shop(models.Model): tripadvisor = models.URLField(max_length=300, blank=True) googleMaps = models.URLField(max_length=300, blank=True) isBookShop = models.BooleanField() + isAccessibleForPeopleWithDisabilities = models.BooleanField(default=False) isCoffeeAllowed = models.BooleanField(default=True) hasLunch = models.BooleanField(default=False) internetQuality = models.CharField(choices=INTERNET_CHOICE, max_length=1, default=INTERNET_CHOICE[2]) diff --git a/findBookCafe/templates/404.html b/findBookCafe/templates/404.html new file mode 100644 index 0000000..c8bcb2f --- /dev/null +++ b/findBookCafe/templates/404.html @@ -0,0 +1,20 @@ + + + {% load static %} {% include "commonHead.html" %} + + 404 error + + + + + + {% include "header.html" %} +
+
+

404

+

Η σελίδα δεν βρέθηκε

+ Αρχική +
+
+ + diff --git a/findBookCafe/templates/cafe.html b/findBookCafe/templates/cafe.html index 9e11d3b..ad40a79 100644 --- a/findBookCafe/templates/cafe.html +++ b/findBookCafe/templates/cafe.html @@ -1,19 +1,8 @@ - {% load static %} - - + {% load static %} {% include "commonHead.html" %} + {{cafe.name}} - - - - @@ -24,7 +13,7 @@

{{cafe.name}}

thumbnail {{cafe.name}}
@@ -69,5 +58,6 @@

{{cafe.name}}

{{cafe.description.html | safe}} + {% include "footer.html" %} diff --git a/findBookCafe/templates/cafeIcons.html b/findBookCafe/templates/cafeIcons.html index d2f0cd2..61206d5 100644 --- a/findBookCafe/templates/cafeIcons.html +++ b/findBookCafe/templates/cafeIcons.html @@ -13,5 +13,7 @@ power {% else %} power_off + {% endif %} {% if cafe.isAccessibleForPeopleWithDisabilities %} + accessible {% endif %} diff --git a/findBookCafe/templates/cafes.html b/findBookCafe/templates/cafes.html index 5858269..bfa795d 100644 --- a/findBookCafe/templates/cafes.html +++ b/findBookCafe/templates/cafes.html @@ -1,17 +1,8 @@ - {% load static %} - - + {% load static %} {% include "commonHead.html" %} + Βρες την καφετέρια που σου ταιριάζει - - @@ -82,5 +73,6 @@ {% include "cafesList.html" %} + {% include "footer.html" %} diff --git a/findBookCafe/templates/cafesList.html b/findBookCafe/templates/cafesList.html index 9a2f612..c6b2ae5 100644 --- a/findBookCafe/templates/cafesList.html +++ b/findBookCafe/templates/cafesList.html @@ -2,7 +2,10 @@ {%for cafe in cafes%}
- + {{cafe.name}}
{% include "cafeIcons.html" %} @@ -10,7 +13,7 @@ >{{cafe.region.name}}, {{cafe.region.city.name}} {{cafe.name}} diff --git a/findBookCafe/templates/commonHead.html b/findBookCafe/templates/commonHead.html new file mode 100644 index 0000000..a02889e --- /dev/null +++ b/findBookCafe/templates/commonHead.html @@ -0,0 +1,23 @@ +{% load static %} + + + + + + + + + diff --git a/findBookCafe/templates/footer.html b/findBookCafe/templates/footer.html new file mode 100644 index 0000000..6541f4b --- /dev/null +++ b/findBookCafe/templates/footer.html @@ -0,0 +1,70 @@ + + + + + diff --git a/findBookCafe/templates/header.html b/findBookCafe/templates/header.html index 46786d2..b539128 100644 --- a/findBookCafe/templates/header.html +++ b/findBookCafe/templates/header.html @@ -11,10 +11,10 @@ > - explore + explore
diff --git a/findBookCafe/templates/index.html b/findBookCafe/templates/index.html index d76b9bd..fe22713 100644 --- a/findBookCafe/templates/index.html +++ b/findBookCafe/templates/index.html @@ -2,10 +2,9 @@ {% load static %} - - + {% include "commonHead.html" %} + Book Cafe - @@ -44,6 +43,7 @@

+ {% include "footer.html" %} \ No newline at end of file diff --git a/findBookCafe/templates/libraries.html b/findBookCafe/templates/libraries.html index 32a00a3..f607cfc 100644 --- a/findBookCafe/templates/libraries.html +++ b/findBookCafe/templates/libraries.html @@ -1,17 +1,8 @@ - {% load static %} - - + {% load static %} {% include "commonHead.html" %} + Βρες την βιβλιοθήκη που σου ταιριάζει - - @@ -82,5 +73,6 @@ {% include "cafesList.html" %} + {% include "footer.html" %} diff --git a/findBookCafe/templates/map.html b/findBookCafe/templates/map.html index 037ef8e..fc996c3 100644 --- a/findBookCafe/templates/map.html +++ b/findBookCafe/templates/map.html @@ -1,15 +1,9 @@ - {% load static %} - - + Βρες την καφετέρια που σου ταιριάζει + {% load static %} {% include "commonHead.html" %} - - Display a map on a webpage