This repository contains the edX E-Commerce Service, which relies heavily on django-oscar, as well as all frontend and backend code used to manage edX's product catalog and handle orders for those products.
Most commands necessary to run and develop the ecommerce service can be found in the included Makefile.
Install the Python/Node/Bower requirements for local development:
$ make requirements
Note: If you want to install only the production requirements run pip install -r requirements/production.txt
.
Setup the database:
$ make migrate
Populate the countries tables (used for storing addresses):
$ python manage.py oscar_populate_countries
Run the development server:
$ make serve
Django Debug Toolbar is disabled by default. Enable it by setting the environment variable ENABLE_DJANGO_TOOLBAR.
Alternatively, you can launch the server using:
$ ENABLE_DJANGO_TOOLBAR=1 make serve
Static files are managed via django-compressor and RequireJS (and r.js) are used to manage JavaScript dependencies. django-compressor compiles SASS, minifies JavaScript, and handles naming files to facilitate cache busting during deployment.
Both tools should operate seamlessly in a local development environment. When deploying to production, call make static
to compile all static assets and move them to the proper location to be served.
When creating new pages that utilize RequireJS dependencies, remember new modules to build.js
.
NOTE: The static file directories are setup such that the build output directory of r.js
is read before checking for assets in ecommerce\static\
. If you run make static
or r.js
locally (which you should not need to), make sure you delete ecommerce/static/build
or run make static
before continuing with development. If you do not all changes made to static files will be ignored.
This app uses Waffle to manage feature gating/switching. Switches can be managed via Django admin. The following switches exist:
+--------------------------------+---------------------------------------------------------------------------+ | Name | Functionality | +================================+=======================+===================================================+ | user_enrollments_on_dashboard | Display a user's current enrollments on the dashboard user detail page | +--------------------------------+---------------------------------------------------------------------------+ | publish_course_modes_to_lms | Publish prices and SKUs to the LMS after every course modification | +--------------------------------+---------------------------------------------------------------------------+ | ENABLE_CREDIT_APP | Enable the credit checkout page from where student's can purchase credit | | | courses. | +--------------------------------+---------------------------------------------------------------------------+
To use google analytics for specific events e.g., button clicks, you need to add the segment key into the settings file:
SEGMENT_KEY = 'your segment key'
To enable custom credit checkout page, please add the following waffle switch:
ENABLE_CREDIT_APP
To run the unit test suite followed by quality checks, run:
$ make validate
For instructions on how to run the acceptance tests, please consult the README file located in the acceptance tests README.
The code in this repository is licensed under the AGPL unless otherwise noted. Please see LICENSE.txt
for details.
Contributions are welcome. Please read How To Contribute for details. Even though it was written with edx-platform
in mind, these guidelines should be followed for Open edX code in general.
Please do not report security issues in public. Please email security@edx.org.
You can discuss this code on the edx-code Google Group or in the #edx-code
IRC channel on Freenode.