liveBook · Manning

Directory structure

As explained in A Pythonic Adventure: From Python basics to a working web app

A directory, also called a folder, is a filesystem container used to organize files and other directories.

A directory, also called a folder, is a filesystem container for organizing files and other directories. Different operating systems may use either term. section 12.1 section 12.0

Use directories to keep related project materials together:

  • Create a general Projects directory for current and future projects. section 12.0
  • Create a separate subdirectory for each application, such as coffeeshop. section 12.0
  • Place application files in suitable subdirectories, such as templates, static, images, and fonts. section 12.0

Organizing the Coffee Shop application

An application initially sits among editor files and templates in mu_code. Moving its related files into Projects/coffeeshop separates the web application from an earlier version and makes its structure easier to manage. Renaming first_app.py to app.py also gives the main application file a clearer conventional name. section 12.0

A directory provides the organizing layer around an application’s files; the application can then work with templates, static assets, and data storage within that project structure. section 12.0 section 12.1

How A Pythonic Adventure: From Python basics to a working web app covers it

How deep it goes
Defines folders and directories, then applies them to a practical application structure without exploring filesystem internals.
Examples
Uses Projects/coffeeshop with templates, static, images, fonts, app.py, and other application files.
What you can do after
Operate/configure projects by separating application files into organized project and asset directories.
How it connects
Connects files, projects, operating systems, templates, static assets, frontend code, backend code, and databases.

Also explained in

Compare how 7 books explain directory structure →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of A Pythonic Adventure: From Python basics to a working web app. The section links point to the parts of the book it draws on.