background preloader

Python

Facebook Twitter

WTForms Documentation — WTForms 2.0.2dev documentation. The Flask Mega-Tutorial, Part I: Hello, World! This is the first article in a series where I will be documenting my experience writing web applications in Python using the Flask microframework. NOTE: This article was revised in September 2014 to be in sync with current versions of Python and Flask. Here is an index of all the articles in the series that have been published to date: My background I'm a software engineer with double digit years of experience developing complex applications in several languages. In addition to Python, I've written web apps in PHP, Ruby, Smalltalk and believe it or not, also in C++. UPDATE: I have written a book titled "Flask Web Development", published in 2014 by O'Reilly Media. The application The application I'm going to develop as part of this tutorial is a decently featured microblogging server that I decided to call microblog.

These are some of the topics I will cover as we make progress with this project: So as you see, I'm going pretty much for the whole thing. Requirements Installing Flask #! . Miguel. Crossplatform Framework for NUI. Welcome | Flask (A Python Microframework) Welcome to Flask’s documentation. Get started with Installation and then get an overview with the Quickstart. There is also a more detailed Tutorial that shows how to create a small but complete application with Flask. Common patterns are described in the Patterns for Flask section.

The rest of the docs describe each component of Flask in detail, with a full reference in the API section. Flask depends on the Werkzeug WSGI toolkit, the Jinja template engine, and the Click CLI toolkit. User’s Guide¶ Flask provides configuration and conventions, with sensible defaults, to get started. API Reference¶ If you are looking for information on a specific function, class or method, this part of the documentation is for you.

Additional Notes¶ Welcome to Flask MongoAlchemy’s documentation! — Flask MongoAlchemy 0.5.4 documentation. Flask-MongoAlchemy adds support for MongoDB on Flask using MongoAlchemy. Source code and issue tracking are available at Github. If you want to get started, check out the example source code. Installation You can easily install using pip or easy_install: $ [sudo] pip install Flask-MongoAlchemy $ [sudo] easy_install Flask-MongoAlchemy If you prefer, you may use the latest source version by cloning the following git repository: $ git clone $ cd flask-mongoalchemy $ [sudo] python setup.py develop Make sure you have MongoDB installed to use it. Usage It is very easy and fun to use Flask-MongoAlchemy to proxy between Python and MongoDB. All you have to do is create a MongoAlchemy object and use it to declare documents.

As you can see, extending the Document is all you need to create a document. Now you can create authors and books: And save them: >>> mark_pilgrim.save()>>> dive.save() If you make any changes on a document, you may call save() again: Preface — Explore Flask 1.0 documentation. Python 2 versus Python 3¶ As I write this, the Python community is in the midst of a transition from Python 2 to Python 3.

The official stance of the Python Software Foundation is as follows: Python 2.x is the status quo, Python 3.x is the present and future of the language. [1] As of version 0.10, Flask runs with Python 3.3. When I asked Armin Ronacher about whether new Flask apps should begin using Python 3, he said that he’s not yet recommending it to people. I’m not using it myself currently, and I don’t ever recommend to people things that I don’t believe in myself, so I’m very cautious about recommending Python 3. One reason for holding off on Python 3 is that many common dependencies haven’t been ported yet.

Since this book is meant to provide practical advice, I think it makes sense to write with the assumption of Python 2. Flask version 0.10¶ At the time of writing this, 0.10 is the latest version of Flask (0.10.1 to be exact).