Problems developing an app for the edx-platform

435 views
Skip to first unread message

Alma Collado

unread,
Feb 20, 2014, 12:06:22 PM2/20/14
to edx-...@googlegroups.com
Hello,

I'm trying following the djangoproyect tutorial to write an app for the edx project. So... if it is not a proyect, only an app inside the edx-platform. Where do I have to create the directory for my app? Inside the /lms directory or the /lms/djangoapps directory? I have create the directory with django-admin.py startapp "my app name" inside the /lms/djangoapps but I don't know if it's correct.

I have also tried to run the server, as it says in the tutorial, I have to do it in the edx-platform directory (where the manage.py file is) but I get:

edxapp@precise64:~/edx-platform$ django-admin.py runserver 0.0.0.0:8000
Traceback (most recent call last):
  File "/edx/app/edxapp/venvs/edxapp/bin/django-admin.py", line 5, in <module>
    management.execute_from_command_line()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
    utility.execute()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 261, in fetch_command
    klass = load_command_class(app_name, subcommand)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 69, in load_command_class
    module = import_module('%s.management.commands.%s' % (app_name, name))
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/importlib.py", line 35, in import_module
    __import__(name)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 8, in <module>
    from django.core.servers.basehttp import AdminMediaHandler, run, WSGIServerException, get_internal_wsgi_application
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/core/servers/basehttp.py", line 26, in <module>
    from django.views import static
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/views/static.py", line 95, in <module>
    template_translatable = ugettext_noop(u"Index of %(directory)s")
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 75, in gettext_noop
    return _trans.gettext_noop(message)
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 48, in __getattr__
    if settings.USE_I18N:
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/utils/functional.py", line 184, in inner
    self._setup()
  File "/edx/app/edxapp/venvs/edxapp/local/lib/python2.7/site-packages/django/conf/__init__.py", line 40, in _setup
    raise ImportError("Settings cannot be imported, because environment variable %s is undefined." % ENVIRONMENT_VARIABLE)
ImportError: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.

Why do I get this  error? Where can I find the settings.py file for the edx-platform? I can'f find it and I also have to add my app in the INSTALLED_APPS...

Thanks for your help!

Alma


Alma Collado

unread,
Feb 21, 2014, 11:44:00 AM2/21/14
to edx-...@googlegroups.com

Anyone can help me with this, please? I really need to know what to do...

Thanks!

Yarko Tymciurak

unread,
Feb 22, 2014, 6:16:37 PM2/22/14
to edx-...@googlegroups.com


On Friday, February 21, 2014 10:44:00 AM UTC-6, Alma Collado wrote:

Anyone can help me with this, please? I really need to know what to do...

Hello Alma -

I see you're trying to do django basic tutorials.

A couple of thoughts:

Try doing an app in a separate, stand alone django server for the tutorials.

Once you get those, and actually want to try to somehow include on in edx's  lms, then you will need to absorb how edx's django setup is different form "the stock" django.

 

Thanks!

El jueves, 20 de febrero de 2014 18:06:22 UTC+1, Alma Collado escribió:
Hello,

I'm trying following the djangoproyect tutorial to write an app for the edx project. So... if it is not a proyect, only an app inside the edx-platform. Where do I have to create the directory for my app? Inside the /lms directory or the /lms/djangoapps directory? I have create the directory with django-admin.py startapp "my app name" inside the /lms/djangoapps but I don't know if it's correct.

I have also tried to run the server, as it says in the tutorial, I have to do it in the edx-platform directory (where the manage.py file is) but I get:

edxapp@precise64:~/edx-platform$ django-admin.py runserver 0.0.0.0:8000

This is the first difference:   typically,  for django development you would use manage.py  (rather than django-admin.py) when that is available.
That is here.

I would start with this:

./manage.py lms --settings==my_environment  help

where you'll probably use "devstack" for vagrant devstack as your settings file.
Help will show you the admin commands available.

The hint is:  your settings file is "devstack.py" in this case, in lms/envs  --- but it's not that straightforward:

in devstack, you will see "from .aws import *" - which in turn has a line "from .common import *" ---

So - your "settings" file is a conglomerate of (in order) default settings from lms/envs/common.py,  plus anything added / overriden by lms/envs/aws.py, plus ....

.... you see - it's a stack of settings.

And, to add, some defaults are set in ansible, and passed on.

The second thing which is not normal is that rather than django-templates,   edx uses mako templates (which write more like "python" in the templates).

That should be enough for you to try / get your "hello world" up, then try to get it up under the edx chain.

From there, you will have many more questions.

As a reminder, most (all?) of your edx course development will be in cms - making lessons, and in xblocks - making extensions / components.

... not that I have a lot of experience in this (Ned, or other edx folks at some point will chime in).

Just for completeness - since you are looking at django tutorials:  have you seen / looked at this yet?  Perhaps this is what you really want (not edx-platform / system development):


Regards,
Yarko

Alma Collado

unread,
Feb 25, 2014, 8:14:14 AM2/25/14
to edx-...@googlegroups.com
Thanks!! I solved it using:

edxapp@precise64:~/edx-platform$./manage.py lms runserver 0.0.0.0:8000 --settings=devstack

to run the server instead of: edxapp@precise64:~/edx-platform$ django-admin.py runserver 0.0.0.0:8000


El jueves, 20 de febrero de 2014 18:06:22 UTC+1, Alma Collado escribió:

Dilpreet Kaur

unread,
Jun 26, 2014, 3:04:15 PM6/26/14
to edx-...@googlegroups.com
Hi Yarko,

Thanks for your post, it gives me lot of knowledge. It seems that you have lot of experience in working on Edx. Can you please tell me how can I master in understanding Edx code. Any material that I should study or anything else that would help me in understanding the flow of code of Edx so that I can customize it according to my needs.

Confidentiality Disclaimer: This email (including any attachment/s) and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

Reply all
Reply to author
Forward
0 new messages