Django app with xblock edx

Hi,
Please I want to know if I can use a django app ( containing views.py and urls.py) in Xblock, and installed it in edx plateform, and add it to a course.
Second can the django app share the same database with LMS ( for example course contents informations).
Thanks in advance

@seni While you can do that, I would recommend against it.

What is your XBlock trying to do? Why do you need to a Django app?

Xblocks generally don’t and shouldn’t deal with the database or LMS directly. You can look into other ways to extend the platform, you can read about such extension points here

1 Like

ok thanks, my xblock should create a plugin of quiz for multiple choice questions, dynamically from a database.

@seni What do you mean by dynamically from a database? Open edX already support a multiple choice questions. You can also use problem-builder which provides some additional features.

What that app is doing is entirely possible to do directly in edx-platform. Is there a reason you need to use that database? Do you already have a large selection of questions there?

Note that, while it is entirely possible to do this, you will need to do a lot of work to create an XBlock like this. You can look at problem builder again, which also uses Django models to understand how that would work.

If you want to bring you existing bank of questions, I would recommend you instead try to create a script that will convert the questions from the existing database to an Open edX course, and then import that. Open edX can import courses created in a special XML format. You should get an idea of how to do this by exporting and existing course.