Boilerplate Jinja
Template boilerplate code used by AppSeed to generate simple starters coded in Flask.
Jinja is basically an engine used to generate HTML or XML returned to the user via an HTTP response. For those who have not been exposed to a templating language before, such languages essentially contain variables as well as some programming logic, which when evaluated (or rendered into HTML) are replaced with actual values.
Features:
UI Ready: the starter contains a
production-ready
designRender Engine: Flask / Jinja2
Deployment scripts: Docker, Gunicorn/Nginx, HEROKU
✨ Environment
To use the starter, Python3 should be installed properly in the workstation. If you are not sure if Python is installed, please open a terminal and type python --version
. Here is the full list with dependencies and tools required to build the app:
Python3 - the programming language used to code the app
GIT - used to clone the source code from the Github repository
Basic development tools (g++ compiler, python development libraries ..etc) used by Python to compile the app dependencies in your environment.
(Optional)
Docker
- a popular virtualization software
✨ Start the app in Docker
👉 Step 1 - Download the code from the GH repository (using
GIT
)
👉 Step 2 - Start the APP in
Docker
Visit http://localhost:5085
in your browser. The app should be up & running.
✨ Manual Build
Download the code
👉 Set Up for Unix
, MacOS
Unix
, MacOS
Install modules via
VENV
Set Up Flask Environment
Start the app
At this point, the app runs at http://127.0.0.1:5000/
.
👉 Set Up for Windows
Windows
Install modules via
VENV
(windows)
Set Up Flask Environment
Start the app
At this point, the app runs at http://127.0.0.1:5000/
.
✨ Codebase structure
The project is coded using a simple and intuitive structure presented below:
✨ UI Assets and Templates
The project comes with a modern UI fully migrated and usable with Django Template Engine.
👉 Page Templates
All pages and components are saved inside the apps/templates
directory. Here are the standard directories:
templates/layouts
: UI masterpagestemplates/includes
: UI components (used across multiple pages)templates/accounts
: login & registration pagetemplates/home
: all other pages served via a generic routing byapps/home
app
👉 Static Assets
The static assets used by the project (JS
, CSS
, images
) are saved inside the apps/static/assets
folder. This path can be customized with ease via ASSETS_ROOT
variable saved in the .env
file.
How it works
.env
defines theASSETS_ROOT
variablecore/settings.py
read the value ofASSETS_ROOT
and defaults to/static/assets
if not found:
All pages and components use the
config.ASSETS_ROOT
variable. Here is a sample extracted fromtemplates/layouts/base.html
:
At runtime, the href
property is resolved to /static/assets/css/style.css
based on the value saved in the .env
file:
👉 Static Assets for production
production
As explained in the Static Assets section, the assets are managed via:
apps/static/assets
- the folder whereJS
,CSS
, andimages
files are savedASSETS_ROOT
- environment variable, that defaults to/static/assets
if not defined
In production, the contents of the apps/static/assets
files should be copied to an external (public) directory and the ASSETS_ROOT
environment variable updated accordingly.
For instance, if the static
files are copied to https://cdn.your-server.com/datta-able-assets
, the .env
file should be updated as below:
🚀 Where to go from here
👉 Access the support page in case something is missing
👉 Use the App Generator to generate a new project
Last updated