5
3

Hi,

The app in my main domain is a django app, where the user will log on. How could I then have the credentials transferred to the osqa app running in a subdomain? I want the user to sign on once, but be able to go back and forth between two applications as though they were one.

I frankly would like to have a single application, but just think that it is complicated to do that, given the early state of osqa, and my main app (django-cms). Neither of these projects were designed (imho) to be "django applications". So I am afraid of interactions if combined, especially regarding things like middleware (to which, in the django-cms, I have added some of my custom modules to boot).

Any ideas welcome!

Thanks.

asked 11 May '10, 18:25

expaand's gravatar image

expaand
731111620
accept rate: 33%


Ok, here is what I finally did.

  1. I decided the best course was to leave each application separate, using their own databases. This limited any possible interaction between the two (which, when I tried it as one database and a single session, there was.)
  2. Make sure each application has a separate SESSION_COOKIE_NAME.
  3. For single signon (SSO), I used django-sso. This works quite nicely, seems fairly secure, is simple, and depends on a secret key you store in each project's settings file.
  4. I wanted to make everything seamless, so that when a user logs into the django-cms project, osqa acts just like some additional pages (via a url staring with /osqa). In order to have everything consistent, including registration, when a new user is created in the cms, I needed to have one created in OSQA. So I added django-piston to OSQA, in order to create some REST api calls.
  5. Via REST, when a new user is added in the cms, a call is made to OSQA, and a user is added there (including an entry into the forum_subscriptionsettings table, which apparently is necessary for osqa to run correctly). I am not happy having to do this, but could not see anything simpler to keep the OSQA app happy.
  6. For development, I use the django "runserver" command, and have each project running on a separate port on my local machine (running linux).
  7. To deploy, I used mod_wsgi. In the Apache virtual host file, I have two entries for WSGIScriptAlias - one for the cms project, at "/", and one for the OSQA at "/xosqa".
  8. It turns out that which the WSGIScriptAlias set up in this way, leave FORUM_SCRIPT_ALIAS to "". Everything works just fine (not sure why, though!), so that when you go to /xosqa, the OSQA project works correctly (yes, of course you have to add this "osqa" to your url's in the cms project, which calls djangjo-sso, which then calls /xosqa with arguments for logging into OSQA via django-sso middleware).
  9. For grins, since I had the REST framework, I added a function to get the last 10 questions, for displaying in the cms.
  10. I made some mods to my custom OSQA skin to remove info for registering or even logging in. I added a menu at the top which duplicates that on my cms pages, with a "Welcome <user>", a "Home" (which goes to the cms home), and a "Logout" (which calls the cms logout).
link

answered 20 May '10, 10:23

expaand's gravatar image

expaand
731111620
accept rate: 33%

Can you tell me the visit url of your site?

(30 Sep '11, 04:02) fangpeng

So I imagine you'll not be running both into the same project. Which in my opinion is a great option since there is no need to be running django-cms specific middleware on each osqa request and vice versa.

Probably the easiest thing to do is to make them share the same database, that way both will use the same user table and session table (if you store sessions in the database).

The biggest problem is related with external authentication providers, since I don't know hoe django-cms handles that info, but I can imagine it is a bit different from OSQA, so basically if someone registers using myopenid from django-cms, you'll have to tell OSQA about it and vice-versa. That problem won't occur with local registration.

But I guess that will be an interesting exercise. Come to the OSQA chat room and I'll try to help you out.

link

answered 11 May '10, 18:39

Hernani%20Cerqueira's gravatar image

Hernani Cerq... ♦♦
16.8k65975
accept rate: 52%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×75

Asked: 11 May '10, 18:25

Seen: 1,110 times

Last updated: 30 Sep '11, 04:02

powered by OSQA