Skip to content

Commit

Permalink
Add api routes prefix so backend is in sync with actual deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
mmihalik committed Dec 17, 2024
1 parent ee79905 commit 11b1f22
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 18 deletions.
8 changes: 5 additions & 3 deletions webstrom/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,19 +166,21 @@
USE_TZ = True

DATETIME_FORMAT = 'd.m.Y H:i:s'

API_PREFIX = 'api/'

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

STATIC_ROOT = os.path.join(BASE_DIR, 'static')

STATIC_URL = '/static/'

STATIC_URL = 'static/'

# Media files

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')

MEDIA_URL = '/media/'
MEDIA_URL = 'media/'
PRIVATE_STORAGE_ROOT = os.path.join(BASE_DIR, 'protected_media/')
SENDFILE_ROOT = PRIVATE_STORAGE_ROOT
SENDFILE_BACKEND = "django_sendfile.backends.simple"
Expand Down
10 changes: 0 additions & 10 deletions webstrom/settings_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,6 @@
"test.strom.sk",
]

APPEND_SLASH = False

CSRF_TRUSTED_ORIGINS = [
"https://test.strom.sk",
]

USE_X_FORWARDED_HOST = True

SECURE_PROXY_SSL_HEADER = ("HTTP_X_FORWARDED_PROTO", "https")
Expand All @@ -39,7 +33,3 @@
("Martin Mihálik", "[email protected]"),
("Peter Kovács", "[email protected]"),
]

MANAGERS = [
("Martin Mihálik", "[email protected]"),
]
15 changes: 10 additions & 5 deletions webstrom/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
from django.contrib import admin
from django.urls import include, path

urlpatterns = [
path('django-admin/', admin.site.urls),
api_urlpatterns = [
path('user/', include('user.urls')),
path('competition/', include('competition.urls')),
path('cms/', include('cms.urls')),
path('personal/', include('personal.urls')),
path('base/', include('base.urls')),
path('protected/', include('downloads.urls')),
# Dočasná cesta pre allauth bez rest frameworku
]

urlpatterns = [
path('accounts/', include('allauth.urls')),
path('django-admin/', admin.site.urls),
path(settings.API_PREFIX, include(api_urlpatterns)),
]

# Pri vývoji servuj media files priamo z djanga
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT)
urlpatterns += static(
settings.MEDIA_URL,
document_root=settings.MEDIA_ROOT
)

0 comments on commit 11b1f22

Please sign in to comment.