Cookie-Cutter in action - For Flask & Django
Hello! This content presents a few practical use-cases of CookieCutter, a popular command line generator used to build digital projects from templates
. All mentioned tools are open-source and the generated code is covered by the MIT license (can be used for commercial projects). During this article, we will generate two dashboards and a beautiful website in Flask similar with these projects:
- ✨ Flask Material Kit - LIVE demo
- ✨ Django Volt Dashboard - LIVE Demo
- ✨ Flask Soft UI - LIVE Demo
The generated code comes with a few basic features like authentication, database, deployment scripts via Docker and a modern Bootstrap 5 design.
✨ How it works
The CookieCutter tool knows how to parse an existing codebase and generate a new product using the input provided by the user. For instance, we can choose the database for a project or decide if a specific code or feature is injected or removed from a product. In our use-cases
users can choose the design, database type and other things like project name, email and project description.
In order to successfully generate the projects in a local environment, we need a minimal programming kit already installed and accessible in the terminal window:
Python3
- the language that powers CookieCutterGIT
- the versioning command-line tool- A modern editor live
VsCode
orAtom
CookieCutter
tool - available via PIP (package manager)Docker
- (optional) for an automatized compilation and start
Once we have all the tools up & running, we can move forward and generate our first project: Flask Material Kit.
👉 Step #1 - Install dependencies via PIP
👉 Step #2 - Generate the project via Flask Cookiecutter
// The Output
The whole process should take less than a minute and the generated code can be found in the flask_material_kit
directory. At this point, we can start the project via Docker using a single command.
👉 Step #3 - Start project in Docker
By default the app should be up & running at address http://localhost:85
and display the sign in
page.
In a similar way we can generate more complex projects like dashboards or even full-stack
apps with React and VueJs as frontend libraries.
✨ Django Cookie-Cutter Volt
In this section we will generate a simple Django Dashboard enhanced with authentication, database and Docker scripts on top of Volt design, a really nice Bootstrap 5 Template.
👉 Step #1 - Generate the project via Django CookieCutter
// The Output
The next step is to start the generated project via Docker, create, register users and interact with the UI.
👉 Step #2 - Start project in Docker
✨ Flask Cookie-Cutter Soft UI
This time, we will generate a futuristic dashboard using Soft UI design from Creative-Tim. The end-product has the same features as the previous starters: authentication, database, a simple clean codebase and Docker scripts. Let's go!
👉 Step #1 - Generate the project via Flask CookieCutter
// The Output
👉 Step #2 - Start project in Docker
Thanks for reading! The source code for all project can be found below:
- ✨ Flask Material Kit - source code
- ✨ Django Volt Dashboard - LIVE Demo
- ✨ Flask Soft UI - LIVE Demo