0

I recently came across the edx project and was fiddling with it. Something that I tried to play with was the idea of importing its features into another project.

the basic structure of this project is

edx-platform
    -cms
    -lms
    -common

one platform that runs two projects and also has some shared modules.

What I tried doing was to set up a different project in django 1.5 and try to import all the projects as per this post, like so.

sys.path.append('/home/user/edx_all/edx-platform/cms')
sys.path.append('/home/user/edx_all/edx-platform/lms')
sys.path.append('/home/user/edx_all/edx-platform/common')

So I am wondering what Import or some other factor about the project did I miss out? Or is this not possible at all with django?

Thanks in advance for any help.

Community
  • 1
  • 1
Anurag Ramdasan
  • 4,189
  • 4
  • 31
  • 53
  • It's not entirely clear from your question want your trying to do. You've tagged your question importerror, but haven't included either the error traceback or the code that produces it. Adding directories to `sys.path` does not automatically include them in your project, it just allows you to import modules in that directory. If you're new to Django and not familiar with installing apps, you may find it easier to explore the edx project using vagrant, as described in its readme. – Alasdair Aug 18 '13 at 20:15
  • Hey sorry if the information wasn't adequate. What I was trying to do was to write views that would interact with the models and libraries of another project, edx in this case. So basically making functions in edx callable from a totally different project. I am not even sure if it is even possible, and hence posted this to just clarify. – Anurag Ramdasan Aug 19 '13 at 13:52
  • It's possible to include apps from external projects. Whether it is easy in this case depends on how tightly coupled the various edx apps are. I'm not familiar with the edx app so I don't know how difficult it will be. Good luck :) – Alasdair Aug 19 '13 at 17:57

1 Answers1

0

If you want to import the apps directly as

import cms
import lms

then add the edx-platform directory to the path

sys.path.append('/home/user/edx_all/edx-platform/')

Adding a directory to sys.path does not include the directory in your project, it simply allows you to import modules from that directory. You then have to add the required modules to your INSTALLED_APPS and import views / functions as required.

Alasdair
  • 298,606
  • 55
  • 578
  • 516
  • I'm guessing the real import wouldn't be `edx-platform`, as you can't have `-` in variable names! – Ben Aug 18 '13 at 18:39