The project as a module
Currently, your folder structure should look like this:
webapp/ config.py database.db main.py manage.py env/ migrations/ versions/ static/ css/ js/ templates/ blog/
To convert our code to a module, our files will be converted to this folder structure:
webapp/ manage.py database.db webapp/ __init__.py config.py forms.py models.py controllers/ __init__.py blog.py static/ css/ js/ templates/ blog/ migrations/ versions/
We will create this folder structure step by step. 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
, but can be called anything except a blog, because the controllers are called blogs. If there are two blog objects to import from, Python will not import objects correctly from the parent directory while importing inside the blog.py
file.
Next move main.py
and config.py
&...