Skip to content

Commit 50070dd

Browse files
committed
feat: some more improvements
1 parent b380479 commit 50070dd

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

.env

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
DEFAULT_DATABASE_DSN=postgres://postgres:password@database_default:5432/db
1+
# DEFAULT_DATABASE_DSN=postgres://postgres:password@database_default:5432/db
2+
# DEFAULT_DATABASE_DSN=postgres://postgres:password@database_default:5432/db
3+
DATABASE_URL=postgres://localhost:5432/db
4+
DEFAULT_DATABASE_DSN=postgres://localhost:5432/db
25
DEFAULT_STORAGE_DSN=file:///data/media/?url=%2Fmedia%2F
36
DEBUG=True
47
DOMAIN_ALIASES="localhost, 127.0.0.1"

apps/jobs/templates/jobs/job_list.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
{% addtoblock "css" %}
2424
{% for css_link in css_links %}
25+
{# Check if with block is even required #}
2526
{% with css_link as css_link %}
2627
<link href="{% static css_link %}" rel="stylesheet">
2728
{% endwith %}

apps/jobs/views.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ class JobsView(TemplateView):
66
template_name = "jobs/job_list.html"
77
def get_context_data(self, **kwargs):
88
context = super().get_context_data(**kwargs)
9+
# Retrieve CSS and JS links from Vite asset manifest
10+
# Remove the main_js_links
911
css_links, js_links, main_js_links = get_css_and_js_link_from_vite_assets("jobs")
1012
context["css_links"] = css_links
1113
context["js_links"] = js_links

backend/settings.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,9 @@
77
BASE_DIR = Path(__file__).resolve().parent.parent
88

99
DEBUG = os.environ.get('DEBUG') == "True"
10-
if DEBUG:
11-
from dotenv import load_dotenv
10+
from dotenv import load_dotenv
1211

13-
load_dotenv()
12+
load_dotenv()
1413

1514
# SECURITY WARNING: keep the secret key used in production secret!
1615
SECRET_KEY = os.environ.get('SECRET_KEY', '<a string of random characters>')

generic/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import List, Tuple
66
from pathlib import Path
77

8-
def get_css_and_js_link_from_vite_assets(project_type: str, uses_client: bool = False) -> Tuple[List[str], List[str], List[str]]:
8+
def get_css_and_js_link_from_vite_assets(project_type: str, uses_client: bool = False) -> tuple[list[str], list[str], list[str]]:
99
"""
1010
Retrieve CSS and JS links from Vite asset manifest.
1111
@@ -20,8 +20,10 @@ def get_css_and_js_link_from_vite_assets(project_type: str, uses_client: bool =
2020
- Main JS links (entry points)
2121
"""
2222
# Construct the path to the manifest file
23+
# TODO: cache the result to ensure reading the file
24+
# again and again.
2325
if uses_client:
24-
manifest_path = Path(f"backend/static/js/{project_type}/build//manifest.json")
26+
manifest_path = Path(f"backend/static/js/{project_type}/build/manifest.json")
2527
# Construct full paths for assets
2628
base_path = f"js/{project_type}/build/client/"
2729
print(manifest_path, base_path)

0 commit comments

Comments
 (0)