Skip to content

Commit 62b9d83

Browse files
committed
update Django version and ui fixes
1 parent a9d2205 commit 62b9d83

File tree

7 files changed

+135
-16
lines changed

7 files changed

+135
-16
lines changed

.dockerignore

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Include any files or directories that you don't want to be copied to your
2+
# container here (e.g., local build artifacts, temporary files, etc.).
3+
#
4+
# For more help, visit the .dockerignore file reference guide at
5+
# https://docs.docker.com/go/build-context-dockerignore/
6+
7+
**/.DS_Store
8+
**/__pycache__
9+
**/.venv
10+
**/.classpath
11+
**/.dockerignore
12+
**/.env
13+
**/.git
14+
**/.gitignore
15+
**/.project
16+
**/.settings
17+
**/.toolstarget
18+
**/.vs
19+
**/.vscode
20+
**/*.*proj.user
21+
**/*.dbmdl
22+
**/*.jfm
23+
**/bin
24+
**/charts
25+
**/docker-compose*
26+
**/compose.y*ml
27+
**/Dockerfile*
28+
**/node_modules
29+
**/npm-debug.log
30+
**/obj
31+
**/secrets.dev.yaml
32+
**/values.dev.yaml
33+
LICENSE
34+
README.md

Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
FROM python:3.10.12-alpine
2+
3+
WORKDIR /usr/src/app
4+
5+
# Set environment variables
6+
ENV PYTHONDONTWRITEBYTECODE 1
7+
ENV PYTHONUNBUFFERED 1
8+
ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1
9+
10+
# Install dependencies
11+
RUN apk update && apk add --no-cache nodejs npm postgresql-dev gettext
12+
13+
# Create necessary directories
14+
RUN mkdir -p /home/app/web/static /home/app/web/media /home/app/web/locale
15+
16+
# Set the app home directory
17+
ENV APP_HOME=/home/app/web
18+
19+
WORKDIR $APP_HOME
20+
21+
# Copy project files into the container
22+
COPY . .
23+
24+
# Install Python dependencies
25+
RUN pip install pip --upgrade && pip install -r requirements/develop.txt
26+
27+
# Ensure entrypoint.sh is executable
28+
RUN chmod +x /home/app/web/entrypoint.sh
29+
30+
# Set the entrypoint script
31+
ENTRYPOINT ["sh", "/home/app/web/entrypoint.sh"]
32+
33+
# Clean up
34+
RUN rm -rf /etc/apk/cache

compose.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
services:
2+
kediuz:
3+
container_name: kediuz
4+
restart: always
5+
build:
6+
context: .
7+
dockerfile: Dockerfile
8+
command: python manage.py runserver 8000
9+
# security_opt:
10+
# - seccomp:unconfined
11+
volumes:
12+
- ./:/home/app/web
13+
- ./media:/home/app/media
14+
- ./static:/home/app/static
15+
- ./locale:/home/app/locale
16+
# - ./logs:/home/app/web/logs
17+
env_file:
18+
- .env
19+
environment:
20+
- TZ=Asia/Tashkent
21+
# ports:
22+
# - ${DJANGO_WEB_PORT}:${DJANGO_WEB_PORT}
23+
depends_on:
24+
- db
25+
26+
db:
27+
image: postgres:14
28+
container_name: "kediuzDB"
29+
volumes:
30+
- postgres_data:/var/lib/postgresql/data
31+
32+
environment:
33+
- POSTGRES_USER=${DB_USER}
34+
- POSTGRES_PASSWORD=${DB_PASSWORD}
35+
- POSTGRES_HOST=${DB_HOST}
36+
- POSTGRES_DB=${DB_NAME}
37+
- POSTGRES_PORT=${DB_PORT}
38+
restart: always
39+
40+
volumes:
41+
postgres_data:

entrypoint.sh

+19-5
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
1-
#!/usr/bin/sh
1+
# !/usr/bin/sh
22

33
# Activate the virtual environment
44
activate_venv="$(pwd)/venv/bin/activate"
55
source $activate_venv
66

7+
# python manage.py migrate
8+
# python manage.py tailwind install --no-input
9+
# python manage.py tailwind build --no-input
10+
# python manage.py collectstatic --no-input
11+
# python manage.py compilemessages
12+
13+
# # Restart services
14+
# sudo systemctl restart gunicorn
15+
# sudo systemctl restart nginx
16+
# echo "gunicorn and nginx restarted ..."
17+
18+
if [ "$DB_USER" = "postgres" ]; then
19+
while ! nc -z $DB_HOST $DB_PORT; do
20+
sleep 0.1
21+
done
22+
fi
23+
724
python manage.py migrate
825
python manage.py tailwind install --no-input
926
python manage.py tailwind build --no-input
1027
python manage.py collectstatic --no-input
1128
python manage.py compilemessages
1229

13-
# Restart services
14-
sudo systemctl restart gunicorn
15-
sudo systemctl restart nginx
16-
echo "gunicorn and nginx restarted ..."
30+
exec "$@"

requirements/base.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Django
2-
Django==4.2.16
2+
Django==4.2.18
33

44
django-allauth==0.63.3
55
cryptography==42.0.8

templates/redesign/home.html

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ <h1 class="font-bold text-3xl px-6">{% trans 'News' %}</h1>
1313
{% for post in posts %}
1414
<div class="overflow-hidden relative bg-zinc-900 rounded-md p-3">
1515
<a href="{% url 'common:post' post.id %}" class="btn btn-primary">
16-
<img src="{{ post.image.url }}" class="w-full sm:h-32 object-cover rounded-md" alt="img">
16+
<!-- <img src="{{ post.image.url }}" class="w-full sm:h-32 object-cover rounded-md" alt="img"> -->
17+
<img src="{{ post.image.url }}" class="w-full object-cover h-64 md:h-10 rounded-md" alt="image">
18+
1719
</a>
1820
<div>
1921
<p class="opacity-50 mt-2">{{post.created_at}}</p>

templates/redesign/lost_animal_list.html

+3-9
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,10 @@
1616
{% endblock %}
1717

1818
{% block content %}
19-
<main class="grid lg:grid-cols-4 max-w-screen-xl items-center mx-auto">
20-
<div class="gap-10 lg:col-span-3 h-full">
21-
<div class="flex justify-between items-center">
22-
<h1 class="font-bold text-3xl px-6">Lost animals</h1>
23-
<!-- <i class="fa-solid fa-magnifying-glass mr-9"></i> -->
24-
</div>
25-
19+
<main class="grid lg:grid-cols-1 max-w-screen-xl items-center mx-auto">
20+
2621
<!-- lost animal list -->
27-
<div class="grid gap-6 p-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-3">
22+
<div class="grid gap-6 p-6 grid-cols-1 md:grid-cols-2 lg:grid-cols-4">
2823
{% for post in posts %}
2924
<div class="relative bg-zinc-900 rounded-md flex flex-col p-3 items-center">
3025

@@ -57,7 +52,6 @@ <h1 class="font-bold text-3xl px-6">Lost animals</h1>
5752
</div>
5853
{% endfor %}
5954
</div>
60-
</div>
6155

6256
</main>
6357
{% endblock %}

0 commit comments

Comments
 (0)