6.3. Manage Static Assets

After you configure a partner and at least one site for the E-Commerce system to use, you must compile all static assets and move them to the correct location to be served. The edX E-Commerce service uses django-compressor and RequireJS to manage static assets.

  • django-compressor compiles and minifies CSS and JavaScript files, and names files to facilitate cache busting after new file deployment.

  • RequireJS manages JavaScript dependencies.

Note

The static file directories are set up so that make static reads the build output directory of r.js before it checks for assets in the ecommerce/static/ directory. EdX does not recommend that you run make static locally. If you run make static or r.js locally, make sure you delete the ecommerce/static/build folder or that you run make static before you continue with development. If you do not run make static again, django-compressor ignores all changes that you make to static files.

6.3.1. Compile and Move Static Assets

To compile and move your static assets and deploy your E-Commerce service, execute the following command locally or on another server.

$ make static

If you create new pages that have RequireJS dependencies, remember to add your new JavaScript modules to the RequireJS build file for the project. This is the build.js file.