I have a working application/system (Python 3.9, Django 3.1) on my server. Now I need to move it to another server with an alias.
From this www.myserver.com
to this www.otherserver.com/myapp
.
In Apache2 config I have line WSGIScriptAlias /myapp /path/to/myapp/wsgi.py
.
But now I have a problem with all links in app, e.g. link from index page to catalog page redirects to www.otherserver.com/catalog
but I need www.otherserver.com/myapp/catalog
.
What is the best solution?
A quick way is to include the projects url patterns at the new path.
Make a new patterns list, e.g. base_patterns
base_patterns = [
path('admin/', admin.site.urls),
path('app/', include('app.urls),
]
At the bottom of the main urls.py include the base_patterns
at the new path.
urlpatterns = [
path('catalog/', include(base_patterns)),
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With