Django url tag adds filepath

混江龙づ霸主 提交于 2019-12-25 07:53:44

问题


In urls.py, I defined as,

url(r'^'+settings.URL_PREFIX+r'$', 'myapp.project.views.index', name="homepage"),

in settings.py, I defined URL_PREFIX as,

URL_PREFIX = 'myapp/'

and in template, I used url tag in an anchor as,

{% url homepage %}

Link becomes:

http://localhost/home/muluturk/web/myapp/myapp/ instead of http://localhost/myapp/. It adds /home/muluturk/web/myapp/ whis is the directory of project. How can I fix this?


回答1:


Problem solved. It caused by apache config file:

PythonOption django.root /home/muluturk/web/myapp

Removing /home/muluturk/web/myapp from this line solved my problem



来源:https://stackoverflow.com/questions/5469988/django-url-tag-adds-filepath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!