0

I am learning angular.js and would like to have a backend to experiment with. What is the quickest/simplest backend I can setup on my development machine? Is it python cgi? I have Apache running.

A bit of context: I do plan an production application and started to do it in Django (I know a smattering) but I thought I would look at angular.js first. For the project, I will have to query a mssql database (I can do that with python). I hesitate to mix Django and angular -- seems like a wreck waiting to happen -- but maybe that is the best way to go.

I have used an ajax connection to a python cgi script in the past, so I thought that might be the simplest way to go. (Some encouragement here for Django: Angular JS and Django)

Too bad angular doesn't come with a simple backend! (or does it?)

Any suggestions?

PS: http://popdevelop.com/2010/03/a-minimal-python-websocket-server/ describes a websocket. Is that a possibility? (Looks neat!)

wgw
  • 601
  • 1
  • 8
  • 20
  • This does seem like an open-ended question (and therefore off-topic), since it becomes "what web framework". There seem to be many comparisons between Bottle (smallest), Flask (more bells and whistles) and Django (batteries included). But not much on angular+framework. In the end, I will probably use Django, mainly because it is familiar. But I will use ajax+python while learning angular : http://stackoverflow.com/questions/336866/how-to-implement-a-minimal-server-for-ajax-in-python. Thanks for all the replies -- Bottle and Flask are very tempting! I just have too much to learn for the moment! – wgw Jun 06 '14 at 17:51
  • One more comment: with tweaks (doc not quite accurate), this will set up a python backend for experimentation: http://mafayyaz.wordpress.com/2013/02/08/writing-simple-http-server-in-python-with-rest-and-json/ I think I will use some version of that... – wgw Jun 06 '14 at 20:05

3 Answers3

2

I would recommend Flask. It is a web microframework (meaning it does not come with a lot bolted on). You can extend it with extensions like flask-sqlalchemy which can integrate with mysql. It also has a built in developer web server so you can jsut do python myapp.py get it going (for production you will need to use apache/mod_wsgi or something like gunicorn).

The docs are easy to follow and there is a brand new book on it.

  • Yes, and Miguel Grinberg's excellent [tutorial](http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world) has now evolved into a [great book on](http://www.amazon.com/Flask-Web-Development-Developing-Applications/dp/1449372627) Flask development. – JoshieSimmons Jun 06 '14 at 03:31
1

I'd look into Bottle if you want to go the Python route. I don't have much personal experience with it but from what I've heard it's very light weight and easy to get started with.

Node is a common backend for an angular app and it's also very easy to get started with.

Lasted I'd try out Firebase. It is a backend-as-a-service so it doesn't get much simpler than that. There's also an example of using it on the angular home page.

rob
  • 17,995
  • 12
  • 69
  • 94
  • Thanks! Re. Firebase: I just realized there is a free version. I will be hosting my app on my own server in the end, but Firebase would allow some experimenting. Bottle looks very trim -- I'll take a better look. – wgw Jun 05 '14 at 23:37
1

We have been connecting AngularJS and django and it tured out to be really easy. In django you have http://www.django-rest-framework.org/ which really simplifies creating REST APIs.

jb.
  • 23,300
  • 18
  • 98
  • 136