Integrating Ember CLI with Django app

Before Ember CLI, I use to create an index.html page within Django project, plus the App.js file and all seemed to be working great.
Now that Ember is using CLI, it seems that there is no easy way to integrate Ember CLI project within Django application.
So I read that people are recommending using Ember CLI to develop the front-end, and Django to develop the REST API. However deployment is not easy, because you need to copy the Ember dist folder under Django static folder, plus change all the static asset url under Ember app to point to Django static path.

So it seems that, there is no easy way to integrate the two into one single development process.

Do you guys, have any suggestions on how to integrate the development, and deployment process?


Best answer

For projects like this, you should use separate repositories for your server app and client app(s).

Consider a project that has 4 code repositories, 1 server and 3 clients:

  • myproject (A Django app written in Python that provides an API for clients)
  • myproject-web (The Ember.js web client written in JavaScript)
  • myproject-ios (An iOS client app written in Swift)
  • myproject-android (An Android client app written in Java)

The core app will be deployed to a server that is capable of hosting Python apps (e.g. uWSGI).

Because the Ember.js project is ultimately a static resource, you can serve it from pretty much anywhere (e.g. NGINX), and point it at a separate API server that hosts the Django project (e.g. See documentation on configuring ember-django-adapter to use a custom API host:

iOS of course would be deployed to the Apple App Store, and the Android project would be deployed to Google Play.

Each repository is a separate codebase with different requirements and deployment strategies—which is why it is best to keep them separate, so you can think about them and work with them in isolation. Just because Django can handle static assets doesn’t mean you should rely on it—trying to host an Ember.js project (or any other JS framework project) within a Django project is just overcomplicating things. Hope that helps.