Directory structure
The directory structure implies logic.
Five major branches: Bin,modules,db,conf,log plus Lib
Each folder has a __init__.py
Core is the entry directory, unique file main.py
Conf is a profile directory, unique file setting.py
Log is a logging file, with multiple log files associated with the end of the suffix. Log
DB is the data file
setting.py Configuration
Enter the Conf setting.py file, configure the root directory path, how the database is stored, and the storage path
Base_dir = Os.path.dirname (Os.path.dirname (Os.path.abspath (__file__)))
Database_engine= ' file '
databases={
' file ': {' path ': '%s/db '%base_dir},
' MySQL ': {
' Host ': ' localhost ',
' Port ': ' 3306 ',
' User ': ' Root ',
' Password ': '
},
' Redis ': {
' Host ': ' localhost ',
' Port ': 6379,
' User ': ' Root ',
' Password ': '
}
}
Log function
Before preparing to write the module, consider which modules (functions) require the log function
In the log folder, separate modules to create a folder to hold the module log, a user a file
Python Software Development Specification