I have used Django framework so far, but because of my participation in Google summer of code. We decided to use something new. It was Flask. And Now I want to share it with you.
It is a microframework, which allows us in really short time create a nice app. I’d like to share my experience in this area to teach you how you can create an app. You will have a possibility to add, delete and update posts.
First of all you need to install flask framework via pip in your command line:
pip install flask
My structure of files looks:
- forms( will contain all form objects in our case only post form)
- templates will contain all app views(listing posts and possibility to create post)
Next step will be create a routes. The main purpose of routes is to recognize urls and execute actions. We need four methods to display list of posts(index), delete post(delete_post), add post(new_post) and update post(edit_post)
That’s all to run your first posts application. Additionally I attach link to project on github, where you can trace whole project code.
Have a nice coding!