template {% url %} tag is giving server's absolute path

8 views
Skip to first unread message

Paul Lanza

unread,
Dec 27, 2018, 11:38:50 PM12/27/18
to Django users
I have recently changed my django project (using A2 hosting) from fcgi to wsgi.  I have successfully gotten the project to work, but I am experiencing a minor caveat I am trying to solve.  Now, when I use the {% url %} tag in the templates to form a link, I get the absolute path of the server (the results still works but the link now looks more ugly).

For example, I might have this in my urls.py

url("^about_us/$", views.about_us, name="about_us")


Then in my template, I would have this

{% url "about_us" %}


In my development, the template will render the link "/about_us" so that when you click the link, it takes you to www.mysite.com/about_us.html

Now, in production, the template will render the link "/home/myproject/myproject/about_us" so that when you click the link, it takes you to www.mysite.com/home/myproject/myproject/about_us.html

How can I get my production template rendering of the url tag to replicate the development rendering of the url tag.

Thanks for any help!
Reply all
Reply to author
Forward
0 new messages