First time here? Check out the FAQ!
1

How do I start understanding how Askbot works?

I have downloaded and set-up Askbot project in Ubuntu. I am using Sublime Text as my editor. I want to understand the flow of how things work. How do I do that?

Where is the MVC model in the code? Where can I find Views and Templates and Model?

I started looking for some familiar patters but I couldn't find it. For example, I was looking for "Hi there!" string to see the template.

Is there a way to see which portion of the code is getting executed in the browser? i.e without adding checkpoints

Nikhil's avatar
79
Nikhil
asked 2013-10-01 06:15:57 -0600
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

2

Askbot is a typical django plugable app + some addons. The most important folders to modify functionality are the common ones on a MVC pattern:

models/ -> this would normally be models.py in this case is a module folder that splits the model definitions into several files so it can be navigated more easily.

views/ -> also this one is a folder module including views files splited into smaller units,

templates/ -> this one includes the HTML code of the templates, it's important to note that askbot uses Jinja2 as template engine, should be more than 90% similar to django templates code.

Other important files to take a look are:

urls.py -> this defines what view function gets executed when a user visits an url.

search/ -> this folder defines the search funtionality according to database/search engine you configure.

forms.py -> form classes used in askbot.

media/ -> javascript is stored here, many features depend on javascript.

Please let me know if you need something else...

EDIT:

To modify stuff on the code easily the procedure should be the following:

  1. Fork the repository on github and clone it into your machine.
  2. Create a virtualenv for your project.
  3. Run: python setup.py develop in the askbot project root, this will install all the dependencies and you won't need to reinstall askbot everytime you make a code change, as your virtualenv will point to your repository code.
  4. Create a sample askbot project with askbot-setup command: this will just be used to run the development server, test suite and all the management commands stuff.
  5. Change code in your fork
  6. Test it with runserver on your sample project.
  7. Does it works? go to step 9, if not continue to step 8
  8. goto sept 5 and fix it!
  9. Continue working on your project :-)
Fitoria's avatar
1.1k
Fitoria
answered 2013-10-01 10:00:33 -0600, updated 2013-10-01 12:05:56 -0600
edit flag offensive 0 remove flag delete link

Comments

Hi, Same case for me, I am starting a web project and would like to reuse partially AskBot .. I am a Django beginner and have read some books like "Two scoops of Django". It seems that the AskBot project is not divided into apps, why ? Thanks !

Romain's avatar Romain (2013-10-01 10:21:27 -0600) edit

I don't understand. When I install askbot, I am seeing these 3 folders: cron, doc and upfiles. Am I missing something? I used "python setup.py develop" to create asktop so that I modify it based on my needs

Nikhil's avatar Nikhil (2013-10-01 10:56:55 -0600) edit

@Romain: because askbot itself is just one app :-) it's not a django project.

Fitoria's avatar Fitoria (2013-10-01 11:52:17 -0600) edit
1

@Nikhil: when you do askbot-setup it creates a project template (without askbot code) that simple calls askbot in your python path, the project template is here: https://github.com/fitoria/askbot-devel/tree/master/askbot/setup_templates and those three folders are just the ones needed to run, so to modify it you'll need to changed code directly in your askbot repo not in your project.

Fitoria's avatar Fitoria (2013-10-01 11:55:13 -0600) edit

Aah..of course.. how silly of me.. So if we make changes to the code, what should be done to reflect the changes in the project?

Nikhil's avatar Nikhil (2013-10-01 11:59:10 -0600) edit

@Nikhil updated my answer.

Fitoria's avatar Fitoria (2013-10-01 12:06:25 -0600) edit
add a comment see more comments