Broken links even after change the site information

20 views
Skip to first unread message

Carlos Quiros

unread,
Jan 6, 2014, 6:52:36 PM1/6/14
to django...@googlegroups.com
Hello.

I have a Django application running in my server http://data.ilri.org/formhub

However the links of the application are broken for example http://data.ilri.org/accounts/register/ instead of http://data.ilri.org/formhub/accounts/register/

I been looking on the internet and also configured the site framework with:

python manage.py shell
>>> from django.contrib.sites.models import Site
>>> one = Site.objects.all()[0]
>>> one.domain = 'http://data.ilri.org/formhub/'
>>> one.name = 'Formhub'
>>> one.save()
>>> quit()
(formhub-env)[cquiros@rmg formhub]$ python manage.py dumpdata sites
Your environment is:"formhub.preset.default_settings"
[{"pk": 1, "model": "sites.site", "fields": {"domain": "http://data.ilri.org/formhub/", "name": "Formhub"}}](formhubnv)

But still the links are broken.

What else do I need to do?

Any help is much appreciated.

Carlos.

trojactory

unread,
Jan 7, 2014, 7:47:38 AM1/7/14
to django...@googlegroups.com
Hi Carlos,

The sites framework is used for storing a human readable name of a domain (in case you are serving your site from multiple domains). It does not change or modify the url structure of your site.

There are only two places where you can actually change the URL structure. First option is to specify the exact URLs in urls.py. The second option is outside Django and involves manipulating the URL by the webserver or using WSGI middleware. For example, if you are using Apache as your web server you can trivially perform URL rewriting using .htaccess files (http://www.addedbytes.com/articles/for-beginners/url-rewriting-for-beginners/)

In your case, I suggest the first option. I guess you are using django-registrations app, then you will need to modify the urls app as follows: url(r'^accounts/formhub/', include('registration.backends.simple.urls')),

Regards,
Arun
Reply all
Reply to author
Forward
0 new messages