Creating a project

$ flask-dj startproject app

If your project need templates and static files

$ flask-dj startproject app -t -st

or

$ flask-dj startproject app --templates --static

If something went wrong

# setup.py
from flask_dj import startproject
from os import getcwd
your_project_name = 'app'
project_dir = getcwd()
startproject(your_project_name, project_dir)
# if your project need templates and static files:
# ProjectConstructor(your_project_name, project_dir, need_templates=True, need_static=True).startproject()

This will create a app directory in your project_dir with the following contents:

app/
    app/
        __init__.py
        config.py
        urls.py
    manage.py

Creating the index app

$ python manage.py startapp index

That`ll create a directory index, is shown below:

app/
    app/
        __init__.py
        config.py
        urls.py
    index/
          forms.py
          models.py
          urls.py
          views.py
    manage.py

Create view function

# index/views.py
def index():
    return "Hello world"

Add start url

Add to index application:

# index/urls.py
from utils.urls import relative_path
from .views import index

urlpatterns = [
    relative_path("", index),
]

Add to main application:

# app/urls.py
from utils.urls import add_relative_path, include

urlpatterns = [
    add_relative_path("/", include("index.urls")),
]

Run project

$ python manage.py runserver