Skip to content

Commit 7432c69

Browse files
committed
Try add static to server
1 parent 6f17953 commit 7432c69

5 files changed

Lines changed: 24 additions & 6 deletions

File tree

.github/workflows/release-ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
labels: ${{ steps.meta.outputs.labels }}
5050

5151
run:
52+
name: 'Run container on server'
5253
runs-on: ubuntu-latest
5354
needs: [ build ]
5455
steps:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ RUN poetry config virtualenvs.create false \
2323

2424
EXPOSE 8000
2525

26+
RUN mkdir /procollab/staticfiles
2627
RUN mkdir /procollab/static
2728

2829
COPY . /procollab/
2930

3031
CMD ["bash", "startup.sh"]
3132

32-
VOLUME ["/procollab/static/"]

poetry.lock

Lines changed: 16 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

procollab/settings.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import mimetypes
2-
import os
32
from datetime import timedelta
43
from pathlib import Path
54

@@ -65,6 +64,7 @@
6564

6665
MIDDLEWARE = [
6766
"django.middleware.security.SecurityMiddleware",
67+
"whitenoise.middleware.WhiteNoiseMiddleware",
6868
"django.contrib.sessions.middleware.SessionMiddleware",
6969
"corsheaders.middleware.CorsMiddleware",
7070
"django.middleware.common.CommonMiddleware",
@@ -132,8 +132,6 @@
132132
"rest_framework.renderers.JSONRenderer",
133133
]
134134

135-
DB_SERVICE = config("DB_SERVICE", default="postgres", cast=str)
136-
137135
DATABASES = {
138136
"default": {
139137
"ENGINE": "django.db.backends.postgresql",
@@ -178,7 +176,10 @@
178176
# Static files (CSS, JavaScript, Images)
179177

180178
STATIC_URL = "/static/"
181-
STATIC_ROOT = os.path.join(BASE_DIR, "static/")
179+
STATIC_ROOT = BASE_DIR / "staticfiles"
180+
181+
STATICFILES_STORAGE = "whitenoise.storage.CompressedManifestStaticFilesStorage"
182+
182183
STATICFILES_FINDERS = [
183184
"django.contrib.staticfiles.finders.FileSystemFinder",
184185
"django.contrib.staticfiles.finders.AppDirectoriesFinder",

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ django-filter = "^22.1"
4747
setuptools = "^65.5.0"
4848
drf-yasg = "^1.21.4"
4949
sentry-sdk = "^1.10.1"
50+
whitenoise = "^6.2.0"
5051

5152

5253
[build-system]

0 commit comments

Comments
 (0)