canufeel
canufeel

Reputation: 893

Ember Django Adapter installation

Im new to Ember and i was trying to set things up to use it in pair with Django for several days and can't make it work. Im pretty ok with the back-end side where django and django rest adapter resides. But the Ember part really gives me a tough time.

I am using django 1.7, python 3.4 in a virtualenv

As it is recommended here - http://calvinx.com/2013/07/11/python-virtualenv-with-node-environment-via-nodeenv/ i have set up nodeenv to set up packages for my project. Then i did

npm install -g bower ember-cli

Then as it is said in the installation instructions for Ember Django adapter i did

npm i --save-dev ember-django-adapter

The next thing i did was

ember init

which built my project dir and files.

BTW i don't really understand should i really do it at that moment or i should first install something using bower like i.e.:

bower install ember-data --save

Or does ember-data go with the ember-django-adapter alltogather?

Then in the ember-django-adaper tutorial it is said to:

and set the API_HOST environment variable in config/environment.js, e.g.:

if (environment === 'development') {   ENV.APP.API_HOST =
'http://localhost:8000';   ENV.APP.API_NAMESPACE = 'api/v2'; } if
(environment === 'production') {   ENV.APP.API_HOST =
'https://api.myproject.com';   ENV.APP.API_NAMESPACE = 'v2'; }

But i don't understand where is this config/environment.js and how eventually am i supposed to serve the html files anyway. Is it expected that i will be running some kind of server service which will serve just my front-end app which will make api calls to django backend with set-up django rest adapter?

In the book "Building Web Apps with Ember.js" by Jesse Cravens and Thomas Q Brady it is recommended to use yeoman instead of ember-cli but as i understand the ember-django-adapter is meant for ember-cli so there is no way to use yeoman in django-ember stack?

Is the python nodeenv package is the correct way to go in django ember development or is it recommended to use full virtualisation for such stack with tools like vagrant?

Are there other ways to integrate django and ember and using ember inside django templates for simple applications? I have been trying to use django-ember but it seems outdated and causes issues when i am trying to use embedded ember-data with {% ember_data_js %} tag.

Again i am really sorry to ask such noob questions from the perspective of node developers but i have been developing in django for some time and ember as well as node.js itself with its packages, generators is a new topic for me. Unfortunately i couldn't find any appropriate tutorial for connecting django and ember using django rest framework. If someone could point me in the right direction or recommend some reading it would be highly appreciated.

Upvotes: 1

Views: 342

Answers (1)

dustinfarris
dustinfarris

Reputation: 1370

The correct order of operations for using ember-django-adapter is:

ember new myproject
cd myproject
ember install ember-django-adapter

This installs the adapter in your project itself, rather than in the working directory you were in before creating the app (I think that's what you were doing).

Upvotes: 1

Related Questions