Currently, your folder structure should look like the following (take a look at the code provided for the previous chapter):
./ config.py database.db main.py manage.py env/ migrations/ versions/ templates/ blog/
To convert our code into a more modular application, our files will be structured as follows:
./ manage.py
main.py
config.py database.db webapp/ __init__.py blog/ __init__.py controllers.py
forms.py
models.py
main/
__init__.py
controllers.py templates/ blog/ migrations/ versions/
The first change to make is to create a folder in your application that will hold the module. In this example, it will be called webapp.
Next, for each module in our application, we will create a respective Python module. If the module is a classic web application...