Ask HN: Help me get started with python for web
6 comments
I second the micro-framework approach to start. I've used a bit of web.py (http://webpy.org/), and on their front page they show their "Hello, world" app. Install web.py, copy the code, run it, and then fire up your browser and point it to localhost:8080. Boom. I'm guessing the other micro-frameworks have something very similar. Choosing which one is up to you!
I recommend starting out with templating all of your code, because if you do wind up switching to a different framework, you'll regret having your HTML/CSS/JS in with your python code.
I recommend starting out with templating all of your code, because if you do wind up switching to a different framework, you'll regret having your HTML/CSS/JS in with your python code.
I'm in a similar situation and just learning Python.
If you setup a VM with a Debian netinstall, it will let you setup Apache / Python / PgSQL right out of the box. From there, I would recommend installing mod_wsgi and following a tutorial for it.
It's more complicated than just using web.py or Django, but you'll have a lot better understanding of how the entire request works.
If you setup a VM with a Debian netinstall, it will let you setup Apache / Python / PgSQL right out of the box. From there, I would recommend installing mod_wsgi and following a tutorial for it.
It's more complicated than just using web.py or Django, but you'll have a lot better understanding of how the entire request works.
A lot of people will suggest Django, and it's definitely the most popular Python web framework (and therefore the most useful if you're looking for a job using one). However, Flask is written in a much more open-ended way that gives you a lot more power to create the structure of the application as you see fit. I've been working with it lately, and I'd suggest giving it a try.
I like http://www.cherrypy.org
Django rulez.
Start with a python micro-framework such as flask. you can easily install it and it has its own dev. server which means you do not need any server configuration etc. to start with. That is what I am doing right now.
If you get further along, then play with major frameworks such as Django.
Micro-framework: http://flask.pocoo.org
Full-stack framework: http://www.djangoproject.com
Micro-framework: http://flask.pocoo.org
Full-stack framework: http://www.djangoproject.com
I second Flask, it's a very simple & easy-to-use framework. Just by following the tutorial, http://flask.pocoo.org/docs/tutorial/, you will be fine. Also, the IRC channel is pretty active.
I've been using Flask the past two months for a personal project (hope to demo it on HN soon!) and I was wondering: what are the significant differences between django and flask? Is it simply the amount of things that are automated for you? Can you do stuff in django that you simply cannot do in Flask?
Not sure if there is an easy answer but there are quite a few threads on this topic on stackoverflow or even HN. Django and flask in my limited experience are both great frameworks but the difference is that flask is micro while django is fully loaded. That does not necessarily mean more automation with django since your project could have specific custom requirements which django out of the box may not work and hence you could use something like flask and extend it to your specific needs.
I personally prefer Flask since it makes me learn a little more about stuff and in love with the Jinja2 templating supported by Flask.
But, when I try to find info on getting python running as a web service on debian/mysql/nginx, I can't seem to find any easy way of getting things set up for python experimentation and learning.
Can anyone help out?