How you can create simple site with python?
I am talking about rather easy, f.ex, the thing is text "Hello World", and you will find button "submit", which (onClick) can have ajax box "submit effective".
I wish to start develop some stuff with Python, and I'm not sure how to start )
I had been wishing more elaborate solutions could be provided to this, becasue it is a sensitive subject. Python web developing is split across plenty of frameworks, each using its good and the bad and each developer using another one. This really is quite unfortunate. What you need to know:
- Use WSGI. Avoid using other things, WSGI may be the latest standard in Python web developing
- Don't develop directly on the top of WSGI, unless of course you really need to (not really for any hello world application)
- Make use of a framework that most closely fits your requirements:
- I performed with Werkzeug (which isn't a real platform, they refer to it as a toolkit) since it is rather easy yet effective. It allows you're employed around the WSGI level (likewise helps you realize how WSGI works) while supplying really helpful features and assistants. Around the Werkzeug website additionally, you will find helpful lessons and such things as that.
- Most likely typically the most popular framework is Django. Not used at all it, but maybe there is a reason behind why it's so popular.
To conclude, go to whichever is nearest for your heart.
I'd cast my election for Django. Not only since it is things i use, but additionally because it features a great tutorial: http://paperwork.djangoproject.com/en/dev/intro/tutorial01/
I believe you can start with a few type of Python web framework. For me personally Web2Py is both simple and easy , effective. Obviously you can make your pages using CGI: no framework needed, however for more difficult sites it's not practical.
As Felix recommended, certainly use WSGI (mod_wsgi) as the gateway interface. It's the modern method of conducting business and also the other major contendor, mod_python, is no more being maintained.
Django is a superb choice if you prefer a full-fledged production-quality framework it comes at the expense of getting lots of overhead along with a pretty steep learning curve.
My suggestion is: Tornado!
I've discovered that Tornado causes it to be super easy to obtain ready to go rapidly. As one example of this is actually the "Hello, World" in the Tornado documentation:
import tornado.httpserver import tornado.ioloop import tornado.web class MainHandler(tornado.web.RequestHandler): def get(self): self.write("Hello, world") application = tornado.web.Application([ (r"/", MainHandler), ]) if __title__ == "__primary__": http_server = tornado.httpserver.HTTPServer(application) http_server.listen(8888) tornado.ioloop.IOLoop.instance().start()
For me that talks by itself.
Edit: You need to note you don't have to make use of the net server that accompany Tornado. It plugs effortlessly into WSGI to operate with whatever server you have going.
All the best during your search!
You are able to write an internet site with Python where the web server is implemented in Python, or perhaps in which Python is known as from another web server. If you don't curently have an internet server setup, the very first choice is simpler. The Python library features a completely functional web server, all you want is add a few techniques to reply to demands.
For any complete illustration of an internet site by using this simple technique, see Creating a simple web server in Python
This method might be beneficial for developing commercial, production internet sites, but it is the easiest way from P(ython) to W(ebsite).