1
votes

Up till now I was using ember by including all required vendor files in Django static folders. With the rise of ember-cli more and more ember related files are not available in stand-alone version. They require using npm and/or ember-cli.

Ember-cli uses npm, and it creates and manages its own files, create all project files and manages loading them... so now how can I integrate than withing a Django application. Like:

  • I want to hook up an ember application on a given page in Django. ember-cli doesn't seems to cover such scenarios?
  • all vendor files (JS and other) must be served by Django / found by staticfiles finders. npm won't install to Django project staticfiles directory.
  • and it would be good to be able to collect files/make apps withing separate subfolders so that older apps won't break when newer app pulls newer vendor files etc.

So is that somewhat doable with ember-cli and Django? What is the best way to handle such projects?

1

1 Answers

0
votes

You are going to need to set up a build and deployment process in order to deploy the assets built by Ember so that they can be served by your Django application.

I want to hook up an ember application on a given page in Django. ember-cli doesn't seems to cover such scenarios?

You can most definitely have an Ember application live within a Django page. Set up your appplication outlet within the page served by Django.

all vendor files (JS and other) must be served by Django / found by staticfiles finders. npm won't install to Django project staticfiles directory.

Set up a process that copies the dependencies downloaded by npm to the static files directory as part of your deployment.

and it would be good to be able to collect files/make apps withing separate subfolders so that older apps won't break when newer app pulls newer vendor files etc.

It would seem an equaly bad idea to have multiple copies of the same dependency floating around -- especially if a single user will navigate to multiple ember applications hosted on various pages of your Django app which rely on the same libraries. You will have to make a choice of whether to try to maintain the depencies for each of your Ember applications individually or to ugrade depencies across each of them at the same time. This will depend on your needs and how tightly coupled the functionality in each of your apps is.