Menu icon Foundation
Integrate foundation for apps with angularjs in a Django project

I have a Django project with the basic functionality in the backend using the Django REST framework, I have 3 models in my Django app with the proper APIs with REST framework.

Now, I need to build the front-end site of this project, what I should to do to integrate Foundation for Apps with all the AngularJS with my Django app?

Thanks.

appsdjangoAngularJS

I have a Django project with the basic functionality in the backend using the Django REST framework, I have 3 models in my Django app with the proper APIs with REST framework.

Now, I need to build the front-end site of this project, what I should to do to integrate Foundation for Apps with all the AngularJS with my Django app?

Thanks.

Philippe Luickx over 4 years ago

+1 for this!
I basically see 2 approaches: either you simply include all the js and css files in your base template for your django project. You would have to set up a lot of stuff yourself (compass e.g.?)
Or you start a foundation project e.g. in your statics folder and point your settings to the right static and template folders.

Struggling with the actual implementation though, any thoughts are welcome here!

Philippe Luickx over 4 years ago

I got a bit further with this, but not functional yet.
The easiest solution seems to me to have a foundation folder within your django static folder.
In that folder, you create a new foundation app with the CLI. You then watch this folder.

With django you simply link then to the app.js, routes.js and foundation.js files and the app.css file that get generated in the build/assets folder.

Where I am stuck is the routes. I do not get a new view, but have a second "full" html view within my ui-view. So the navbar is duplicated and all...

Philippe Luickx over 4 years ago

So I managed to get it running and now I am trying to figure out a good workflow.
The problem with the routes was that django is serving the templates, but the Front Matter that Foundation Apps is using declares paths that miss part of it. So django can't find the correct templates, resulting in issues.
E.g. I have my foundation files in static folder, so the templates in my build folder are in
static/foundation/build/templates/index.html
However, the routes have the template paths defined as templates/index.html

When you change the routes.js file that is generated with the correct paths, everything works fine.

I have been wondering though, should the front-end be served by Django or would an easier setup just be to have the standard solution (nodejs?) running and configured when deploying? And have Django running to serve only the REST api?