-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial commit of Django application boilerplate and base models #1
Conversation
This commit adds the following * Boilerplace app code generated with the Django `startapp` command * The README file that provides a start of the installation steps for review * Learner report and learner report row data models. Please read the inline documentation in the models.py * Baseline default settings in settings.py * App config in apps.py * Baseline setup.py * Generated migrations for the existing models * .gitignore file generated by github
@johnbaldwin how much critique are you willing (i.e. have time) to address. I mean, for sure comments like "Lets drop webpack" are not welcome, right? |
@bezidejni Can you also take a look at this? |
@omar I'm open to "let's drop webpack" (really this is about this code uses tool X and I want it to use tool Y) under two conditions
Oh, also #3 : How does X or Y for that matter fit with the direction which Open edX is in and how well does it play with Django? |
@OmarIthawi This is partly why I want to do this package a layer at a time, so that we can have these kinds of discussions and help, as a team, to shape a robust system |
@@ -0,0 +1,104 @@ | |||
# Byte-compiled / optimized / DLL files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add .idea
, makes it easier for code newbies like me who uses PyCharm (vs being super super competent and using vim
😄).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OmarIthawi Sure, added
|
||
1. Install edx-figures. ``pip install edx-figures`` | ||
|
||
2. Add the following to ``lms.env.json``:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lms.env.json
is meant to be machine written. Let's say (or Ansible server-vars.yml)
here to help Open edX newbies not to get lost.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OmarIthawi I've run into a number of occasions where the official docs refer to manually updating the env/auth json files. While I agree that in a proper production deployment environment, these are automatically generated, it seems in practice this is not always the case in the community. Therefore, I'll add mention to add vars to files included with --extra-vars
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question: is server-vars.yml
a common accepted community term for files the playbook includes via --extra-vars
?
Also, as I'm working on adding language to describe how to set up the --extra-vars
YAML file, I realize that configuration will need to be set new variables into lms.env.json
. For example: There is currently not support to automatically insert EDX_FIGURES
into lms.env.json
. This means that folks in the community will need to
A) use our configuration fork
B) Modify their instance (or edx.orgs's instance) of configuration
C) Update lms.env.json
directly
Also, to note, edx-figures
vars are loaded from lms.env.json
to django.conf.settings
via our envs/settings customizations. So implementors will need to customize their edx-platform
envs/settings to use edx-figures
I'm considering this to be beyond the scope for this initial PR. I don't want to get sidetracked/delayed. What I've done is create an issue item: #2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnbaldwin the standard edX way of adding new variables to lms.env.json
is:
So we shouldn't modify our fork at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A question: is server-vars.yml a common accepted community term for files the playbook includes via --extra-vars?
Not sure, you can ignore my comment about that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @johnbaldwin is right, in most places in the docs they mention editing the lms.env.json
file, probably because most people developing and testing things have devstack set up and that's the way to do it there, and if you're actually deploying production edX instances, you know how to get the variable to the generated json file anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
|
||
"APPSEMBLER_FEATURES": { | ||
"ENABLE_EDX_FIGURES": true, | ||
"LMS_URLS_INCLUDE": [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a very easy contribution to edX, no? Added it to the list.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OmarIthawi Yes, pretty easy. What testing do we need to include with this to help with the upstream PR? Also, please see my previous comment ^^^ . I think the vendor community around Open edX would find 'vendor additions' support in configuration
and edx-platform
to be helpful in reducing fork customization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@johnbaldwin not sure if it's worth any tests. You can go ahead and open the PR, I can help if edX has any comments. It would be a great exercise for us.
edx_figures/settings.py
Outdated
APP_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
# Mapping to create settings root level keys | ||
ENV_KEYS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is here, but please remember that edX also have a YAML config file. edx-figures
should be use from django.conf import settings
to consume either one transparently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an artifact of me figuring out how to minimize edx-platform
tailoring for custom packages like edx-figures
. I don't need it now and can remove it.
@OmarIthawi I'm interested in how you would implement the following:
A) provide defaults in the reusable Django app
B) Ability to override those defaults with implementor custom settings
details:
A reusable django/open edx app (like edx-figures) has some default settings we declare in the package (in settings.py). If the implementor does not want to override these settings, the implementor doesn't have to do anything, just import these into django.conf.settings
like we do in lms/envs/appsembler.py
and lms/envs/(aws|devstack)_appsembler.py
If the implementor DOES want to override settings, then those settings are (ideally) generated via configuration into lms.env.json
or (less ideally) manually added to lms.env.json
. In either case we've got a scenario of being able to override defaults in the edx-figures
package
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start! I've added a big chunk for comments.
|
||
from edx_figures.settings import EDX_FIGURES | ||
|
||
EDX_FIGURES.update(ENV_TOKENS.get('EDX_FIGURES', {})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like an anti pattern to me! Let's make it work for edx/edx-platform
smoothly. More comments in the settings.py
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, just a few lines it's named EDX_FIGURES_SETTINGS
which can cause confusion.
edx_figures/settings.py
Outdated
} | ||
] | ||
|
||
EDX_FIGURES = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since this is expected to be overridden let's rewrite it like the following:
- Import-time rewrite:
Add the following line after the definition:
EDX_FIGURES.update(ENV_TOKENS.get('EDX_FIGURES', {}))
- Possibly the previous suggestion won't work because of circular dependency, here's a lazily loaded alternative:
def get_edx_figures_config():
configs = { ....
configs.update(ENV_TOKENS.get('EDX_FIGURES', {}))
return configs
Very clean, and compatible with vanilla edX (<-- should be a top priority since we're open sourcing it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OmarIthawi I'm not 100% clear on what you're suggesting. How about I merge this PR and you get this cleaner setttings approach to work in your sandbox and pull a PR with what you suggest for improving the custom settings? We can then document this approach together and use it as a model for future reusable django apps/open edx "plugin" apps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with Omar, seems like a nice solution, just needs some testing as John mentioned.
@@ -0,0 +1,3 @@ | |||
from django.test import TestCase |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome!
edx_figures/urls.py
Outdated
from . import views | ||
|
||
urlpatterns = [ | ||
url(r'$', views.edx_figures_spa, name='edx-figures-spa'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
edx_figures_spa
-> edx_figures_home
(I like that more)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I have no issue renaming this
edx_figures/views.py
Outdated
def edx_figures_spa(request): | ||
|
||
context = { | ||
'edx_figures_api_url': 'http://api.foo.com', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be configurable, no?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OmarIthawi Sure. This is a placeholder. As we build out the real API and figure out our configuration/settings organization, we'll load it from settings
setup.py
Outdated
packages=find_packages(), | ||
include_package_data=True, | ||
license='MIT License', # example license | ||
description='Reporting and data retrieval for Open edX', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's better if both package.json
and setup.py
are consistent. description
is different.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. Consistent now, thanks!
package.json
Outdated
"url": "git+https://github.com/appsembler/edx-figures.git" | ||
}, | ||
"author": "", | ||
"license": "ISC", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hate it when npm
suggests ISC
license. Let's use MIT
, well known permissive license. Unless of course you have another opinion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding MIT for now. We can review which to put when we prep for opening up the repo
setup.py
Outdated
version='0.1.0', | ||
packages=find_packages(), | ||
include_package_data=True, | ||
license='MIT License', # example license |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove # example license
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
setup.py
Outdated
classifiers=[ | ||
'Environment :: Web Environment', | ||
'Framework :: Django', | ||
'Framework :: Django :: X.Y', # replace "X.Y" as appropriate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do that # replace "X.Y" as appropriate
comment and the comments below.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set to 1.8 since that is what is used by Ficus
'Topic :: Internet :: WWW/HTTP', | ||
'Topic :: Internet :: WWW/HTTP :: Dynamic Content', | ||
], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a bit annoying to see the X marks here for missing new lines. I'm perfectionist, I know!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added newline
@johnbaldwin my comment looked more aggressive than I meant. Don't worry I'm not a Webpack hater 😄 I've added a lot of inline comments and here are high-level ones:
|
@OmarIthawi Replies to top level comments:
After we have an actual working UI (that does something) +100%. Until then, I really don't think it makes sense. To note: I include compiled assets in Taxoman for exactly the reason you specified
Since you've got significant experience developing tests for Open edx and I've got to get up to speed on this, I'd really appreciate what specific help you can provide that would either set a testing scaffolding for the different aspects we want to test or help me ramp up faster (or both).
Any suggestions here on something we've reinvented the wheel on in
Do you see any direct database access in this initial PR? |
👍
I'll take some time this week to initialize the the testing scaffolding.
Nope, just a future note. |
@johnbaldwin Thanks for addressing the comments. I'll go ahead and approve the PR. I've added to issues that should help to keep the scope of this PR as is, however, suggests next-step improvements:
I will probably take the lead on #3 since providing the code would be easier than conveying idea. You're welcome to take the lead on #4, and I will be helping on that front as well. |
|
||
1. Install edx-figures. ``pip install edx-figures`` | ||
|
||
2. Add the following to ``lms.env.json``:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think @johnbaldwin is right, in most places in the docs they mention editing the lms.env.json
file, probably because most people developing and testing things have devstack set up and that's the way to do it there, and if you're actually deploying production edX instances, you know how to get the variable to the generated json file anyway.
Front-end Client App | ||
-------------------- | ||
|
||
edx-figures has a skelton React app and simple/minimal webpack build configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo in word "skeleton"
|
||
from edx_figures.settings import EDX_FIGURES | ||
|
||
EDX_FIGURES.update(ENV_TOKENS.get('EDX_FIGURES', {})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, just a few lines it's named EDX_FIGURES_SETTINGS
which can cause confusion.
edx_figures/settings.py
Outdated
} | ||
] | ||
|
||
EDX_FIGURES = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree with Omar, seems like a nice solution, just needs some testing as John mentioned.
@johnbaldwin could you please add "write access" to me? |
Please see: #1 NOTE: This is a work in progress (WIP) with the next stage to incorporate UI work that Matej is working on. So the asset management is going to likely change I pulled out installation and configuration instructions from the README since there were significant comments in the PR about this and this is definitely going to change as we work to make this package easier to intergrate with edx-platform.
@OmarIthawi I addressed a number of your comments. To note: How edx-figures is configured and installed in edx-platform is likely going to change, so instead of putting a lot of time into making solid installation and configuration instructions, I scrubbed that out of the README. As Matej and I work on the package and we figure out how we're going to structure asset management I'll update the README when we know where things are going Matej needs this repo now in order to incorporate the UI work he's done so far, so unless you see anything that is fundamentally breaking, please approve. Thanks! |
@OmarIthawi Openedx team had read only permissions, sorry. Changed to read/write |
Thanks @johnbaldwin! Let's move this forward and address the issues in future PRs. |
@OmarIthawi Thanks! Also thanks for noting things in the issues section, I appreciate it! |
Bump figures to 0.3.12
This PR is a starting point that covers three areas
The plan is after we get this reviewed/comments addressed, we'll move forward and add reporting, testing, then UI
Some details:
startapp
commanddocumentation in the models.py