Skip to content

Commit 283ae24

Browse files
authored
fix: fixing missing static files in local development #948
fix: fixing missing static files in local development #948
1 parent ccbb951 commit 283ae24

File tree

4 files changed

+12
-10
lines changed

4 files changed

+12
-10
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,7 @@ fabric.properties
249249
.DS_Store
250250
/backend/media/
251251
/backend/notebooks/
252+
/backend/static/
252253
/backend/staticfiles/
253254

254255
# Fixture

backend/custom/middleware.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,8 @@ def process_template_response(self, request: WSGIRequest, response: TemplateResp
1818
elif "form" in context:
1919
errors = context["form"].errors
2020
if errors:
21-
user = request.user
2221
endpoint = request.get_full_path()
23-
logger.warning(
24-
f"{repr(errors)}",
25-
user=user,
26-
errors=errors,
27-
endpoint=endpoint,
28-
type="validation",
29-
)
22+
logger.info(f"Validation errors on {request.method} {endpoint}: {repr(errors)}")
3023
except Exception:
3124
logger.exception("Error processing template response in LoggerMiddleware:")
3225
finally:

start-server-dev.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#!/usr/bin/env bash
22
# start-server-dev.sh
3+
4+
# The compose.yaml file mounts our repository as a volume in the /app folder,
5+
# which overwrites the static files collected during image build.
6+
# So we need to collect the static files again at runtime.
7+
echo "> Collecting static files"
8+
(cd /app; python manage.py collectstatic --no-input --settings=backend.settings.base)
9+
310
echo "> Making migrations"
411
(cd /app; python manage.py makemigrations)
512

6-
echo "> Migrating"
13+
echo "> Applying migrations"
714
(cd /app; python manage.py migrate)
815

916
echo "> Installing debugpy"

start-server.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
#!/usr/bin/env bash
22
# start-server.sh
3+
34
echo "> Making migrations"
45
(cd /app; python manage.py makemigrations)
56

6-
echo "> Migrating"
7+
echo "> Applying migrations"
78
(cd /app; python manage.py migrate)
89

910
echo "> Creating superuser"

0 commit comments

Comments
 (0)