Epalissad
Epalissad

Reputation: 451

AngularJS app hosted on Google AppEngine

I have a AngularJS app hosted on GAE (Python) with a handler that renders the AngularJS (index.html) template. And from there I can render partials in my Angular app.

The issue I'm having is that if I refresh a partials, let's say my about page (about.html), there is no handler for it in GAE and I get a 404. I could of course create a handler, but then I'm managing templates in 2 places.

How can I let AngularJS do all the routing? What's the best practice for handling the routing when hosting a AngularJS app on GAE?

Thanks in advance! Let me know if something is unclear. I'm new to both AngularJS and GAE, apologise if I use the wrong terms.

Solution: Not my code, but I solved it in the same way. https://github.com/DerekRies/Angular-App-Engine/blob/master/main.py

Thanks for your answers.

Upvotes: 1

Views: 5095

Answers (2)

UnPlan2ned
UnPlan2ned

Reputation: 183

If you want to do it client-sided you have to disable the html5 mode:

$location.Html5mode(false)

Upvotes: 1

Fábio Uechi
Fábio Uechi

Reputation: 837

Have you tried adding your partials directory to the list of static files in app.yaml config file? Something like this:

- url: /(img|css|js|partials)(.*)
  static_files: static/\1/\2
  upload: static/(img|css|js|partials)/(.*)

Upvotes: 1

Related Questions