diff --git a/.gitignore b/.gitignore index 681ceb5..07b766b 100644 --- a/.gitignore +++ b/.gitignore @@ -135,3 +135,6 @@ GitHub.sublime-settings !.vscode/launch.json !.vscode/extensions.json .history + +#postgres pass files +*.my_pgpass diff --git a/artel/Dockerfile b/artel/Dockerfile index ef47bd3..a8b15d3 100644 --- a/artel/Dockerfile +++ b/artel/Dockerfile @@ -1,5 +1,5 @@ # Use an official Python runtime based on Debian 10 "buster" as a parent image. -FROM python:3.8.1-slim-buster +FROM python:3.11.3-buster # Add user that will be used in the container. RUN useradd wagtail diff --git a/artel/Dockerfile.local b/artel/Dockerfile.local new file mode 100644 index 0000000..e42726d --- /dev/null +++ b/artel/Dockerfile.local @@ -0,0 +1,36 @@ +# Use an official Python runtime based on Debian 10 "buster" as a parent image. +FROM python:3.11.3-buster + +# Port used by this container to serve HTTP. +EXPOSE 8000 + +# Set environment variables. +# 1. Force Python stdout and stderr streams to be unbuffered. +# 2. Set PORT variable that is used by Gunicorn. This should match "EXPOSE" +# command. +ENV PYTHONDONTWRITEBYTECODE 1 +ENV PYTHONUNBUFFERED 1 + +# Install system packages required by Wagtail and Django. +RUN apt-get update --yes --quiet && apt-get install --yes --quiet --no-install-recommends \ + build-essential \ + libpq-dev \ + libmariadbclient-dev \ + libjpeg62-turbo-dev \ + zlib1g-dev \ + libwebp-dev \ + && rm -rf /var/lib/apt/lists/* + +# Install the project requirements. +COPY requirements.txt / +RUN pip install -r /requirements.txt + +# Use /app folder as a directory where the source code is stored. +WORKDIR /app + +# Copy the source code of the project into the container. +COPY ./ /app + +# Collect static files. +RUN python manage.py collectstatic --noinput --clear +CMD ["python", "manage.py", "runserver", "0.0.0.0:8000"] diff --git a/artel/artel/settings/base.py b/artel/artel/settings/base.py index 8663caf..36fcf80 100644 --- a/artel/artel/settings/base.py +++ b/artel/artel/settings/base.py @@ -88,12 +88,13 @@ WSGI_APPLICATION = "artel.wsgi.application" # Database # https://docs.djangoproject.com/en/4.1/ref/settings/#databases +import dj_database_url as db_url + DATABASES = { - "default": { - "ENGINE": "django.db.backends.sqlite3", - "NAME": os.path.join(BASE_DIR, "db.sqlite3"), - } + "default": db_url.parse( + "postgres://comfy:password@db/comfy_shop" + ) } diff --git a/artel/artel/static/images/las_ruinas_PL.png b/artel/artel/static/images/las_ruinas_PL.png new file mode 100644 index 0000000..fa4327d Binary files /dev/null and b/artel/artel/static/images/las_ruinas_PL.png differ diff --git a/artel/artel/templates/base.html b/artel/artel/templates/base.html index 1b32201..3b2ad3c 100644 --- a/artel/artel/templates/base.html +++ b/artel/artel/templates/base.html @@ -26,6 +26,7 @@ {# Global stylesheets #} + {% block extra_css %} {# Override this in templates to add extra stylesheets #} @@ -34,17 +35,20 @@ {% wagtailuserbar %} -
-
- {% main_menu template="menu/custom_main_menu.html" %} -
-
- {% block content %}{% endblock %} +
+
+
+ {% main_menu max_levels=3 template="menu/custom_main_menu.html" %} +
+
+ {% block content %}{% endblock %} +
{# Global javascript #} + {% block extra_js %} {# Override this in templates to add extra javascript #} diff --git a/artel/artel/templates/menu/custom_main_menu.html b/artel/artel/templates/menu/custom_main_menu.html index 939c5c8..bc1a9f1 100644 --- a/artel/artel/templates/menu/custom_main_menu.html +++ b/artel/artel/templates/menu/custom_main_menu.html @@ -1,14 +1,18 @@ - \ No newline at end of file +{% load static %} +
+ + + +
+ +
+ +
\ No newline at end of file diff --git a/artel/docker-compose.yml b/artel/docker-compose.yml new file mode 100644 index 0000000..20b5cdf --- /dev/null +++ b/artel/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3.8" +services: + comfy: + build: + dockerfile: Dockerfile.local + context: ./ + ports: + - "8000:8000" + volumes: + - .:/app + db: + image: postgres + restart: always + environment: + POSTGRES_ROOT_PASSWORD: password + POSTGRES_USER: comfy + POSTGRES_PASSWORD: password + POSTGRES_DB: comfy_shop + volumes: + - ../postgres/:/var/lib/postgresql diff --git a/artel/requirements.txt b/artel/requirements.txt index 1b91496..238e7f3 100644 --- a/artel/requirements.txt +++ b/artel/requirements.txt @@ -1,3 +1,5 @@ Django>=4.1,<4.2 wagtail>=4.2,<4.3 -wagtailmenus>=3.1.5, <=3.1.7 +wagtailmenus>=3.1.5,<=3.1.7 +psycopg2>=2.9.5,<=2.9.6 +dj-database-url<=2.0.0 diff --git a/artel/store/models.py b/artel/store/models.py index 8851557..2f08f43 100644 --- a/artel/store/models.py +++ b/artel/store/models.py @@ -31,4 +31,3 @@ class ProductConfig(models.Model): class Product(models.Model): template = models.ForeignKey(ProductTemplate, on_delete=models.CASCADE) config = models.ForeignKey(ProductConfig, on_delete=models.CASCADE) -