问题
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