First time here? Check out the FAQ!

Gabriel's profile - activity

2012-07-16 17:32:33 -0500 received badge Famous Question (source)
2012-05-10 23:16:38 -0500 received badge Stellar Question (source)
2011-11-17 04:20:02 -0500 received badge Notable Question (source)
2011-07-29 09:50:18 -0500 received badge Great Question (source)
2011-07-26 08:24:45 -0500 received badge Favorite Question (source)
2011-07-14 02:07:53 -0500 received badge Popular Question (source)
2011-06-09 14:21:59 -0500 marked best answer How to use askbot as a pluggable django app?

If I wanted to integrate some other django app with askbot, I would first try to put both in the same project.

For example, make a copy of your project including the database, then add askbot directory to the project and splice files urls.py and settings.py. Backing up the database will be very important here.

Askbot's sample project files are in the directory askbot/setup_templates.

Finally, run migrations (there are two apps to migrate for askbot - just run python manage.py migrate. All the extra fields on the user model will be added by askbot's migrations.

On the migrations - PostgresQL will help here. If a migration fails - a transaction will roll back to the previous successful migration and you will not end up in the middle of a failed one. With MySQL you might, then you'd have to clean the database manually or start over.

The add_missing_subscriptions command will fill the holes in the data of pre-existing users.

There is also a management command add_askbot_user which might help creating new user accounts in the case you prefer to stick to your existing user registration system. The management command can be called programmatically via django.core.management.call_command

Where you might have difficulties - askbot uses internal login app and registration app (will be decoupled soon), and there are some middlewares that may get in the way of other apps. Please let us know of such issues.

2011-06-09 14:21:40 -0500 received badge Scholar ( source )
2011-06-09 14:21:40 -0500 marked best answer How to use askbot as a pluggable django app?

Reusable app is the goal with an option to use askbot as a whole package.

Changed June 5 2011 Starting version 0.6.93 (available on github and pypi) askbot fully supports external authentication/user registration apps, all documentation on the subject will be here:

http://askbot.org/doc/askbot-as-reusable-django-application.html

The remaining gotcha at the moment is that auth.models.User model, it is monkeypatched with add_to_class (in models/__init__.py) calls and migrations. As long as your other apps do not use the same extra fields, there should'n be problems. It is not very nice, but I have not yet heard from anyone that it prevented askbot from working with other apps.

Probably the right way is to have a separate model for askbot user profile data, something like AskbotUser linked with the auth.models.User.

Directory patches contains monkeypatches that "upgrade" some parts of Django to the level of 1.3. Askbot will (at least was tested at one point not too long ago) work with Django 1.1 to 1.3 without changes. For example - csrf protection will work on 1.1 even though it is not present in django 1.1.

Jinja2 templates are used for speed and more flexibility in programming.

Also I plan to use Google Closure for javascript, jquery will be gradually phased out (by gradually I mean - very gently - without breaking anything or shocking anyone. :)

I'll come back to your question tomorrow.

2011-05-27 14:23:50 -0500 received badge Good Question (source)
2011-05-27 12:09:24 -0500 received badge Nice Question (source)
2011-05-27 03:23:16 -0500 received badge Student (source)
2011-05-27 01:09:29 -0500 asked a question How to use askbot as a pluggable django app?

I have seen mentioned in a few places that it shouldn't be too much work to integrate askbot into an existing django-based project (e.g., see here), however I haven't been able to find a comprehensive answer to how feasible that is. Has anyone actually done this? What needs to happen to make it work?

There are three ways to do integration: either as a pluggable app as part of the main site, as a separate site backed by the same DB using the django sites framework, or as "multiple Django instances hosting different parts of your URL space, allowing them to have multiple settings files." (That last option came from here, though I'll admit I'm not exactly sure how this would work in practice)

All thses options have a few obvious issues:

  • Does askbot still monkey-patch the django user model? I haven't found where that actually happens in the askbot source. What would be needed to clean that up? What else is being monkey patched? Is all of this black-magic contained in the askbot/patches directory?
  • What to do with existing users? OSQA's answer to this question isn't very encouraging: "OSQA is not meant to follow the philosophy of reusable django apps" -- I'm hoping askbot is a bit better in this regard. Is just running "add_missing_subscriptions" sufficient?
  • Beyond creating the User entries, what happens when a user is registered? Is it possible to use an external django user registration system? (ie can the process of migrating existing users happen continuously for new signups?) Obviously this is a bit different depending on whether askbot is installed as an app within the larger project or just backed by the same DB, since in the former case, it should be pretty easy to use signals to do any needed updates. In the multi-project configuration, some sort of (probably ugly) rpc layer might have to be used.
  • Is there any problem using Django 1.3? (Could askbot be coerced into using the static files framework?)
  • Are there any other standard Django best-practices that askbot doesn't follow, which I should be aware of?

Hmmm...that ended up being pretty long. And I'm sure there are a few other gotchas that I'm missing :P

Anyways, we've been pretty impressed after playing a bit with our standalone test deployment of Askbot, so I'm excited to get it integrated with the rest of our project. I do have some django development experience, so if there is a bit of work to do on askbot's core in order to make it more easily pluggable, I'm certainly willing to contribute, but before I sink too much time going down that path, I'd like to get some idea of the scope of the problems to be overcome.

Thanks!