- Install interpreter, develop under
Python 3.6
- Install Python package
pip install -r requirements.txt
- Install
MySQL
- create your own db, create
instance
folder under project root path - create
config.py
underinstance
folder, addSQLALCHEMY_DATABASE_URI
- run
src/models.py
to create table
python item_recorder.py
- Install package.
pip install memory_profile
- Add a decorator on function
import profile
@profile
def method_to_log():
pass
- install package.
pip install matplotlib
- record memory changes.
mprof run item_recorder.py
- display image.
mprof plot mprofile_xxx.dat
,xxx
like a timestamp auto generated
The objgraph.growth
will show the increase in peak object counts since last call.
Default is Top 10.
- install package.
pip install objgraph
- add code
import objgraph
...# some code above...
objgraph.show_growth()
# If the program like a event-loop
# Try to catch `KeyboardInterrupt` event, like:
try:
pass
except KeyboardInterrupt as e:
objgraph.show_growth()
Uncomment the line in src/__init__.py
, or disable debug
mode.
# app.config.update(SQLALCHEMY_RECORD_QUERIES=False)