- This is a software refactoring project for the TJ-flea-market project. The project builds corresponding http service web pages based on the Python Flask framework, and uses MySql as the database back-end.
- Developed in collaboration with the gitlab group, the original project is at Gitlab project
- More information in the Documents
- We use python=3.10.0 and Python Flask framework in our project.
- See requirements.txt or environment.yml for the dependency library
- You are advised to use anaconda to manage the python environment and install the required dependent libraries
- Version 8.0.29
- We changed the database name, user name, and password in the config file in the original project
- Here is how to configure user privileges in the database:
mysql> CREATE USER 'root'@'%' IDENTIFIED BY 'PASSWORD';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;
Use anaconda to configure the environment as follows:
conda create -n tj_market python==3.10.0
conda activate tj_market
pip install -r requirements.txt
OR
conda env create --file environment.yml
-
Before formal operation, clear the following contents:
- the user avatar
user/resource/user-pic/*
(except80000000/
anddefault_avatar.jpg
) - the commodity information
item/static/resource/item_pic/*
,item/static/resource/temp/*
- user chats
chat/static/resource/temp/*
- the user avatar
-
In
config.py
, setdrop_database
toFalse
-
In
app/init_database.py
, the bottom ofinit_database()
function, commentfake_data()
to disable auto mocked data -
In
api/routes.py
, comment the "test backdoor" for the verification code registering:
if code == "IEW32DGCBCDZI2B3ELJ7KIAS4HQZMU0M": # 测试用后门
return [0, "验证通过"]
- In the python or anaconda environment, to run the program:
python main.py
OR you can follow the instructions of Python Flask to modify the run params