Saturday, October 6, 2012

Problem with URL configuration - cannot use absolute URLs in my case

Hi

I have a website at example.com/mywebsite. All URL requests directed to this URL are directed to my app.

Now I have the following project structure

   mywebsiteroot/
      -- myapp/
           -- manage.py
           -- myapp/
                 --templates/
                 --settings.py
                 --models.py
                 --views.py


When my base.html template includes a link "mylink" which shows some information.
On the home page this works fine. my django app receives a URL request for example.com/mywebsite/mylink which I serve using base.html template.

Now I extend the base.html template elsewhere in another view mylink/<some_integer>.
In that view the link points to example.com/mywebsite/mylink/mylink which is obviously wrong. If I use an absolute link /mylink; I get a request at example.com/mylink and not example.com/mywebsite/mylink which is also wrong.

So how do I code my url conf / view / template in order to be independent of mywebsite name.
Is there anything wrong with the way I am wiring up my application.

Thanks in Advance!

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/django-users/-/pAvBYC2INMUJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate