Log in

relativizing the urls

  • 2
  • 20 Aug '14

I found the Spirit software about a week ago. It's very attractive and elegant, and I'm trying to integrate it into an existing Django site. A few questions came up. Sorry, they are questions from a novice. Here is the first of them.

For integration into the existing site, it would be simpler for the forum-related urls to appear not at

www.example.com/

but at something like

www.example.com/teaching/forum/

It just about worked to put

url(r'^teaching/forum', include('spirit.urls', namespace="spirit", app_name="spirit"))

in the site's main .urls file. But in a couple of places, apparently urls related to authentication, this gives a 404. For example, when the user isn't logged in, then clicking on "create topic" sends the browser to

http://www.example.com/login?next=/teaching/forum/topic/publish/

But after changing the .url configuration, the login page is at

http://www.example.com/teaching/forum/user/login/

Perhaps I'm overlooking a simple way to fix this.

Thanks...

Max

nitelyEsteban Castro Borsani
  • 20 Aug '14

Hi!

url(r'^teaching/forum', include('spirit.urls', namespace="spirit", app_name="spirit"))

That should work just fine. You are probably overwriting LOGIN_URL in your settings.py.
There is a settings.py example that extends the Spirit settings, you should use it as your settings.py base. If you need to set any Django setting, you should check first the Spirit settings so you don't break things.

There is also a local settings sample file you can use to define common settings such as database config. You can't extend Spirit settings here, only overwrite them. Rename it to local_settings.py and it will be imported by your settings.py.

  • 20 Aug '14

Oh, thankyou! Yes, that was exactly it.

Reply