Flask Biography Tutorial Part XI : Managing Database Migration in Production Environment Using Alembic

   

Our Openshift's application current state using the latest revision
Our Openshift's application current state using the latest revision
 

Although I never marked our live Bio Application as published, actually at the current state it shouldn't be treated as a production quality application. The main reason is simple : up until now, our database will always be recreated when application started, discarding any data already entered by our users. We do this to allow us focusing our work on perfecting application features than to manage our own database migration script.

Today we are going to have a look on how exactly a database migration technique is implemented. It will allow our application to be stamped as Production Quality application, as it will allow users to registered safely into our application. Whatever development changes we introduce, our users data will not just get thrown to the void. The database schema will be upgraded and existing data will be merged to the new schema.

In our beloved Python world there are plenty of database migration tools available. But as we use SQLAlchemy, well, don't you think that the author of SQLAlchemy should be the  the legitimate author to write its database migration tool? Well then, introducing Alembic!

 (More)



Flask Biography Tutorial Part IX : Creating Product Portofolio Page

 

A compact layout of our Portfolio table

Figure IX-1 Portofolio grid in Bio Page complete with action buttons

 

Before we going further on our journey of making a fully functional Bio Application, lets return to our early concept of this application : product portfolio show case. And guess what we missed. Correct. We missed the required application model for a product portfolio. If you rethink our application models until this state, we know we haven't add a portfolio model/table. This part of article series will guide you on how exactly it's done by adding Portfolio model using SQLAlchemy relationship field in our existing Users mode.

 (More)



Flask Biography Tutorial Part VI : Adding Sign Up Form using Bootstrap 3 and Flask-WTF

 
 
   
    Figure VI-1 A secure Sign Up form with validation and nice visual layout
 

Welcome to the sixth instalment of this Bio Application Development Tutorial. I constructed this tutorial, in such a way that even a newcomer in Python will be able to grasp its content and follow it easily. Thanks to Python intuitive coding environment, my job is not that hard. But it is you who really decide whether my goals are met or I still have to refine how I presented ideas, instructions and concepts.

Previously, our Bio Application having its first data access capability by using a great ORM tool, SQLAlchemy. It able to construct Users tables, populate data and query those data.  But it still lack an important feature : a visitor still unable to register him/herself into our application. In this article, we are going to show you how exactly it is done.

 (More)



Flask Biography Tutorial Part V : Implementing Application Model using SQLAlchemy + PostgreSQL 9.2

 

 
Even Batman need a Biography
Even Batman needs a Biography

In this fifth article we are going to liven up our bio application with real data coming from the database. From our previous post, we already have a nice visual representation of our bio application. Now it is time to supply its content with user very own data. It will make your application feels so nice. Alive.

We are going to utilize SQLAlchemy to do :

  • Model definition : let's define a single Users class which will hold all of our registered users.
  • Data population : as we already have the place to store the data, now let's populate it with sample data.
  • Data query : if certain user page is requested, for example http://bio-ekowibowo.rhcloud.com/ekowibowo (I reserved this username, sorry), let's query his/her data and ...
  • Data display : .. let's display it in our bio.html template page.

A sharp eyed reader may notice, "How do you populate those data? I don't see any user signup action there!". Correct! We are going o skip those important feature for now. Here, I am going to concentrate you on the SQLAlchemy part. I think my next article will going to talk about those Signup form. 

 (More)




Copyright(c) 2014 - PythonBlogs.com
By using this website, you signify your acceptance of Terms and Conditions and Privacy Policy
All rights reserved