Skip to content

Commit

Permalink
config: Update Django configuration to remove subpath /server/
Browse files Browse the repository at this point in the history
  • Loading branch information
drikusroor committed Feb 7, 2024
1 parent e86bdec commit 0c4fb0e
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 18 deletions.
3 changes: 0 additions & 3 deletions backend/aml/production_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

STATIC_URL = '/django_static/'

# Make sure Django runs on subpath /server
FORCE_SCRIPT_NAME = '/server/'

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
Expand Down
4 changes: 0 additions & 4 deletions backend/aml/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@
# ^ The static helper function only works in debug mode
# (https://docs.djangoproject.com/en/3.0/howto/static-files/)

# Run Django on /server subpath
if settings.FORCE_SCRIPT_NAME:
urlpatterns = [path(settings.FORCE_SCRIPT_NAME, include(urlpatterns))]

# Debug toolbar
if settings.DEBUG:
import debug_toolbar
Expand Down
12 changes: 1 addition & 11 deletions nginx/custom-nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,12 @@ server {
alias /nginx/upload/;
}

# Proxy other /server/* requests to the Django app that runs on http://server:8000
location /server/ {
proxy_pass http://server:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}

# Proxy all other requests to the Django app
location / {
proxy_pass http://server:8000;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
}
}

0 comments on commit 0c4fb0e

Please sign in to comment.