Skip to content

Examples & Scaffolds

Starting a project can be a bit tricky mostly because some decisions need to be made regarding maintenance and structure of a project. Usually is something like:

  1. How should you structure the folders.
  2. Where should I place X files.
  3. Where should the settings be.

And some others.

Bear in mind this is simply one example how to structure and does not constitute any opinionated option. You are free to ignore this section and do it in your own way.

Esmerald scaffold

To help you out with some of those decisions, we developed a scaffold with some examples how to jump start a project quickly without wasting a lot of time and presenting one folder option for the project.

What does it bring

  • deployment folder - Where some deployment files are placed. This is based on a previous doc about docker. Feel free to ignore.
  • - Auto generated readme file with instructions how to run.
  • Makefile - Classic UNIX like Makefile with some pre-defined commands used within the scaffold.
  • The project itself - The source code for the scaffold.
    • apps - Where the scaffold apps live.
    • core - Containing core common files, such as settings.
    • tests - Some already made tests for the scaffold views.
    • main - Containing the application logic to start.
    • serve - A personal touch. Based on Django, we thought it would be nice to have a similar file that helps you out with the startup of a project. Should only be used for development purposes.
    • urls - Containing urls of the application.


The auto-generated of the scaffold contains some instructions how to run it quick and simple using the Makefile commands.

How to use it

To use the scaffold you will need to have installed:

And to install, run:

$ cookiecutter

And simply follow the instructions.

Once the project is generated you should have a folder structure similar to this:

├── Dockerfile # similar Dockerfile.conf from the docker examples
├── Makefile
├── deployment
│   ├── nginx.conf # similar nginx.conf from the docker examples   └── supervisor.conf # similar supervisor.conf from the docker examples
├── requirements.txt
└── src # or the name given by you when generating the project
    ├── apps
       └── welcome
           └── v1
    ├── core
          └── __init__.cpython-39.pyc
       └── configs
           ├── development
           └── testing
    ├── tests

The welcome app

The way the scaffold was designed was not to replace any possible design, instead, it was conceived with the idea of facilitating your life when starting a project.

The welcome app located inside /apps/ contains two examples of views. One as function based view and another using classes and permissions.

The tests are running against those views so if you delete them, the tests are expected to fail.

The URLs

The urls were structured to show you how powerful the Include is and how clean an instance of Esmerald can be when starting a project containing a log of urls as you can see from the


The settings where placed inside a config folder and separated by enviroment also to show you what Esmerald means by Simplicity from settings.


Contains all available commands that can be used within the scaffold and if you want to list them all simply run:

$ make # Lists all available commands

The Makefile contains two very important commands. The make run and the make test.

As you can probably notice, the make run runs with the DevelopmentSettings module and the make test with TestingSettings module.

Both development and testing settings are passed via ESMERALD_SETTINGS_MODULE.

We hope this scaffold can help you clearing out some ideas or even giving you new ones for your applications.

Nginx, Gunicorn, Tortoise and Docker

We all know how hard it can be to think about deployments and configurations to go live and for that reason there is also a cookiecutter available based on the esmerald scaffold with a lot of extra files prepared for the deployment (if needed) and adds an extra flavour in case you want to also use Tortoise ORM.

This can be done for any ORM, really. The goal of the cookiecutter is to give a complex, production ready and similar approach to the normal go-lives.

How to use

To use the scaffold you will need to have installed:

And to install, run:

$ cookiecutter

And simply follow the instructions.

What does it bring inside

As mentioned before, this is very similar to the esmerald scaffold so you can expect a similar folder structure as that one but also adds some extras.

  • deployment - Folder containing nginx, supervisor and gunicorn configurations.
  • docker - Folder containing a Dockerfile ready to be used and deployed.

The URLs, tests and Makefile file also follows the same structure as the esmerald scaffold.

For a more comprehensive explanation, simply install the cookiecutter and give it a try.