This commit is contained in:
Michał Gdula 2023-06-19 12:12:22 +00:00
parent 7617e19e66
commit 4394e713bd
4 changed files with 24 additions and 10 deletions

View file

@ -11,7 +11,7 @@ WORKDIR /app
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY website .
COPY ./website/ /app/
COPY run.sh run.sh
RUN chmod +x run.sh

View file

@ -1,6 +1,5 @@
#!/bin/sh
# Wait for database to start
until pg_isready -d $POSTGRES_DB -h db -U $POSTGRES_USER
do
echo "Waiting for database to start... (5s)"
@ -9,8 +8,6 @@ done
echo "Database is ready!"
# Check if there are any changes to the database
#python3 manage.py showmigrations
if (python3 manage.py showmigrations | grep "\[ \]" > /dev/null);
then
echo "Database changes detected! Migrating..."
@ -18,7 +15,9 @@ then
python3 manage.py migrate
fi
# Start server!!!!
# echo "Collecting static files..."
# python3 manage.py collectstatic --noinput
echo "Starting server..."
gunicorn --bind :8000 website.wsgi:application

View file

@ -29,6 +29,10 @@ DEBUG = True
ALLOWED_HOSTS = ["*"]
CSRF_TRUSTED_ORIGINS = [
'https://*.leggy.dev',
]
# Application definition
@ -124,7 +128,7 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.2/howto/static-files/
STATIC_URL = "static/"
STATIC_URL = "static"
STATICFILES_DIRS = (join(BASE_DIR, "static"),)
STATICFILES_FINDERS = [
"compressor.finders.CompressorFinder",
@ -132,7 +136,7 @@ STATICFILES_FINDERS = [
"django.contrib.staticfiles.finders.AppDirectoriesFinder",
]
MEDIA_URL = "media/"
MEDIA_URL = "media"
MEDIA_ROOT = join(BASE_DIR, "media")
COMPRESS_ROOT = join(BASE_DIR, "static/")