Forums

How to share a template between Django and Angularjs

Any advice on how to accomplish that would be appreciated. Or just to point me in the right direction. Not sure if my problem is understanding how Pythonanywhere static directory works, or how to include a django url(or view) in the Angular $routeProvider route.

I have included my static directory in the PA web tab.
My $routeProvider works fine when using normal routes like...
... templateUrl: static/templates/layout/index.html

But I'm unable to find a way to point that Angular route to a django url, so that the prerendered django template would be used as an Angular partial.

Sorry if I'm not making my self clear. Let me know if more info is needed. I understand about the tag syntax difference. Thanks.

Can you access the template in your browser at the URL you're using?

No. And the javascript console doesn't give any errors. It just show and empty template in the partials view section of the page. BTW, the page becomes unresponsive.

Thanks. Based on your question, I started searching the reason for not showing on the URL, and now I think is working.

did it worki want to use angular js two with django can i ?

Yes, Angular (or any other client-side JavaScript framework) should work fine with PythonAnywhere.

(I should add -- parts of PythonAnywhere used to use Angular with Django Rest Framework. We've moved over to a combination of React and DRF, but that was based on our internal preference for React over Angular, not because there were integration problems with Angular.)

good to know because right now im trying to get it to work i have DRF working as the API now just trying to get angular to do the front end but am running into like some road block

does angular code work in the editor for pythonanywhere.com i see that it stays black and white it would be huge if you guys could do a basic tut for people would help you guys in buisness as well since angular two is continuing its rise

Thanks for the suggestion! What is the file extension for the Angular code in Angular 2? My only experience has been in Angular 1, which used HTML.