Skip to content

Commit

Permalink
Add SITE_PREFIX env variable for site url prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
Ananya Maiti authored and Ananya Maiti committed Apr 25, 2023
1 parent 9caf34e commit 261f1b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ HOST_NAME=db
DB_PORT=5432
BROKER_URL=redis://redis:6379/0
CELERY_RESULT_BACKEND=redis://redis:6379/0
SITE_PREFIX=
SITE_NAME=junction
SERVER_PORT=8888
GOOGLE_ANALYTICS_ID=google_analytics_id
Expand Down
11 changes: 8 additions & 3 deletions settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,6 @@
ACCOUNT_DEFAULT_HTTP_PROTOCOL = "https"
EMAIL_SUBJECT_PREFIX = ACCOUNT_EMAIL_SUBJECT_PREFIX

LOGIN_REDIRECT_URL = "/"

# E-Mail Settings
EMAIL_BACKEND = "django.core.mail.backends.smtp.EmailBackend"
Expand Down Expand Up @@ -212,12 +211,18 @@
USE_L10N = True
USE_TZ = True

STATIC_URL = "/static/"
SITE_PREFIX = os.environ.get("SITE_PREFIX", "")
STATIC_URL = SITE_PREFIX + "/static"
STATIC_ROOT = os.path.join(APP_DIR, "assets", "collected-static")
STATICFILES_DIRS = (os.path.join(APP_DIR, "static"),)

MEDIA_ROOT = join(ROOT_DIR, ".media")
MEDIA_URL = "/m/"
MEDIA_URL = SITE_PREFIX + "/m/"

LOGIN_URL = SITE_PREFIX + '/accounts/login/'
LOGOUT_URL = SITE_PREFIX + '/accounts/logout/'

LOGIN_REDIRECT_URL = SITE_PREFIX + "/"


DATABASES = {
Expand Down

0 comments on commit 261f1b7

Please sign in to comment.