0

I am trying to deploy my django on a server, but this server has an extra tag for the url like this. http://john.example.com/mywebsite instead of http://john.example.com

so whenever I want to redirect from the homepage to other pages, I got error messages because the redirected pages are missing the extra tag /mywebsite

for example I want to direct to http://john.example.com/mywebsite/apple but when I choose on link on the template it direct me to http://john.example.com/apple

so I just wonder if there is a way to fix this by setting default home directory to http://john.example.com/mywebsite instead of http://john.example.com/ so I don't have to fix all my code

Thanks you

1 Answers1

1

In your settings.py, add FORCE_SCRIPT_NAME = 'path', where 'path' is the directory where the project resides.

For example, if your site exists at http://john.example.com/mywebsite, settings.py would contain FORCE_SCRIPT_NAME = '/mywebsite'.

rnevius
  • 26,578
  • 10
  • 58
  • 86