White advanced development specifications python code standardization

Development of norms

Software development, project directory structure norms, codes, standards, specifications, etc. follow PeP8, make you more clear and rational development

A functional classification (file name)

settings.py profile

Profiles put some static parameters,

Was placed under a fixed path, the absolute path to the file, basically variable, i

For example, file paths , database ,, default settings of the software

lib Public

common.py common components

Decorator aid use

Main Service logic (code and other functions)

Common components function to other functions, holding on business needs, a common plug-in, password encryption, serialization function, log function

Main core logic

src.py (main logic) the logical file Kernel function

Options mapped directly to the corresponding function

Core logic file, you need to choose

These core functions functions throughout the document

bin Start

start.py Project Initiation Document

The purpose is placed in a prominent location convenient to use open.

register file (something similar database)

User-related data, user information more files

logging file (log)

A total of four types of developers

System Log

Web logs grab the user's residence time

Supporting the development of such an error log

User information transfer log to store information

Log log files are stored, where the operation of the logged, enabling developers to easily tour, inquiry

Two directory

specification

Do not set the catalog of shortcomings

1. regardless of the directory is not clear chaos

2. inconvenient to call

staart not directly applicable to the provisions of

conf Configuration

db database

log log

README instructions

A brief description of the project, in order to give readers a quick overview of the project

It needs to explain a few things
Positioning 1. Software
2. Run the code: Install environment, start a command
3. Brief instructions for use
4. Code directory structure, you can explain in more detail the basic principles of software
5. Frequently asked questions

sys module file is run it will be some modules (built and the current directory) is automatically loaded into memory,

How to refer to the module,

That the name of this module in space is not in memory

If not a direct reference module, it is not built or the current ratio py file in the current directory files

Ask to be invited to add to the memory

import sys

sys. path. After the append ( 'r. Joining path') a number of manually loaded into memory modules, added, can be directly referenced

form sec import run can be used

Built-in module time json pickle, etc.

Memory - Built--sys.path #

Dynamic access to the root directory (the directory grandfather (father directory (the son of the current directory _ File _)))

Add to memory sys

Dynamic module reference file path splicing

Guess you like

Origin www.cnblogs.com/strawberry-1/p/11285991.html