Flask Project Template You’re Gonna Love

Web Development & Project Template

This is always a big headache to choose a project structure for large web applications. Specially when you have to deal with many web technologies for the successful build. This also concerns the long term technical support and further development of the project.

Simplicity is the best policy

Besides when tons of technologies have to be handled like REST, Styling, Security, Websockets and many more(a long never ending list of technologies), you are in a big trouble. It is the burden to choose the right project structure, right tools and right way. Right way doesn’t mean the best way. It means the way most suitable for a successful build of the project at hand and web development is a hungry beast in this area. Everyday something new, something more interesting is coming up and blowing off the developer’s mind making him wondering –

Was it the right choice of tools and technologies ?

Well, this question can never be satisfactorily answered.

My Opinion (if that matters)

I, being the project leader of a few web applications, found out, flexibility should always be welcomed. But it also has it’s cost. It is the cost of choice. When tons of options are floating around you, you may find it quite difficult to choose the so called right option.  As a python developer, I always find Python as a very flexible language platform. There are many web framework around the world like Django, Pyramid, Flask, Tornado and many more (you may write a script and declare it as a web framework). Django is quite popular with a large community and web support. But it does fall in short at some points including it’s ORM, which is the most important fact for decision making for me most of the time. Well if you don’t need complex relationships, Django is definitely a good choice. But for real complex scenario SQLAlchemy is the top choice without any doubt. But unfortunately if you remove the ORM from Django and try to integrate SQLAlchemy in it, it becomes very much useless.  It may not even worth the effort. So the other options like Pyramid, Flask, Tornado etc become very tempting at those points. I used to prefer Pyramid for it’s awesome documentation and still it is a great choice and gives so much flexibility that you can use 2 different kind of routing and both are really cool. But it may seem too much work sometimes. Tornado is another beast. It’s fast. Really fast. But when you are using ORM stuffs its not that much fast and you to work a lot with designing the app in asynchronous way. Another option – Flask, hit me as a viable choice when flexibility is a fact. I found Flask as simple as you can get while giving you the flexibility you may want. A very misleading concept, Flask is a micro-framework may stop you right here. But it’s not really a micro-framework.

Previously I made a project template for Pyramid, and it was Flask’s turn and I made another template for Flask too.

Flask Runner

It’s called Flask Runner . It’s a cookiecutter project template and it utilizes the concept of factory based application. It also utilizes Flask’s Blueprint  concept which is much similar to Django’s app.

Details are in the documentation of the project – Flask Runner Documentation . If you are a Python full stack web developer you may find it very convincing as it gives you all the flexibility you are looking for with a solid project structure. Well, speaking of solid, it gives you options but no choice is made for you except one- SQLAlchemy. And speaking of flexibility, there is no view or route or model definition in the template by default which you might have to remove/delete first before you make up your own. It’s simple. It may look like Django style, but it’s not, it’s Flask. If you need admin interface, just use Flask-Admin.

Conclusion

The irony of this part is, there is no conclusion. Web technologies are evolving everyday. Every now and then something is changing and something else is breaking things up. So one thing is certain you need flexibility if you can handle the cost of choice.

Advertisements

Explanation

This is a follow-up of the previous Tutorial as a lot of things remained unexplained like how to customize or use the Makefile suitewhy using an infinite loop inside main (it’s a common question from freshers)why we need a cpu clock (like we have used 1MHz for the hello_world)where did those DDRB,PORTB stuffs come from and so on. Let’s walk through them one by one. Continue reading