Site name displayed in django urls

I had a problem when calling the url template tag in Django adds the site name (I don't want it there).

Let's say the site name is "mysite".

So for example:

<a href="{% url myapp.views.myview "myparam" %}">Link text</a>

produces:

<a href="/mysite/foo/bar">Link text</a>

when I want it to create:

<a href="/foo/bar">Link text</a>

My urls.py is configured as follows:

from django.conf.urls.defaults import *
import mysite.myapp.views

urlpatterns = patterns('',
    (r'^/foo/bar/$', 'mysite.myapp.views.myview'),
)

Can someone point me in the right direction?

Edit - when the site was under development, it was in a subdirectory of the test server, and the application as a subdirectory! Therefore, he sat at http://www.mytestserver.com/mysite . There is no caching, and all links to / mysite have been removed before they go live.

+3
source share
2

modpython, . , PythonOption django.root /mysite .

+6

, -? Docs , url, .. /mysite/foo/bar. ? render_to_string ( , ) , example.com.

+1

Source: https://habr.com/ru/post/1732554/


All Articles