Skip to content

Commit 7802582

Browse files
committed
The changes made in this commit include:
- Modified `STATIC_URL` to include `MAIN_PAGE` variable. - Modified `MEDIA_URL` to include `MAIN_PAGE` variable. These changes include updating the `STATIC_URL` and `MEDIA_URL` to include the `MAIN_PAGE` variable, which allows for dynamic URL generation based on the environment variable value. Additionally, the URL pattern in `urls.py` has been modified to include `MAIN_PAGE` variable in the path.
1 parent aed54c6 commit 7802582

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/signal_documentation/settings.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,21 +169,19 @@
169169

170170
LOCALE_PATHS: list[str] = [os.path.join(BASE_DIR, 'locale')]
171171

172+
MAIN_PAGE = os.environ.get('MAIN_PAGE', '')
172173

173174
# Static files (CSS, JavaScript, Images)
174175
# https://docs.djangoproject.com/en/4.2/howto/static-files/
175176

176-
STATIC_URL: str = '/static/'
177+
STATIC_URL: str = f'{MAIN_PAGE}/static/'
177178
STATICFILES_DIRS: tuple[str] = (os.path.join(BASE_DIR, 'assets'),)
178179
STATIC_ROOT: str = os.path.join(BASE_DIR, 'staticfiles')
179180

180-
MEDIA_URL: str = '/media/'
181+
MEDIA_URL: str = f'{MAIN_PAGE}/media/'
181182
MEDIA_ROOT: str = os.path.join(BASE_DIR, 'media')
182183

183184

184-
MAIN_PAGE = os.environ.get('MAIN_PAGE', '')
185-
186-
187185
# Default primary key field type
188186
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
189187

src/signal_documentation/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
urlpatterns: list[URLResolver] = [
3939
path('admin/', admin.site.urls),
4040
path('__debug__/', include('debug_toolbar.urls')),
41-
path(settings.MAIN_PAGE, include('signals.urls')),
41+
path(f'{settings.MAIN_PAGE}/', include('signals.urls')),
4242
]
4343

4444
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # type: ignore

0 commit comments

Comments
 (0)