For testing purposes only.
Project repository: Link (Extraction code: 0000)
Local Environment Setup (Options 1, 2, 3 can be adjusted per requirement)
-
Modify the port number in
rest_api/restapi-teach/backend/project/cherrypy_startup.py(any available port). -
To enable session-based authentication before login, change
FalsetoTrueinrest_api/restapi-teach/backend/project/settings_common.py. -
Configure MySQL settings in
rest_api/restapi-teach/backend/project/settings.py:- Comment out SQLite configuration.
- Uncomment MySQL configuration and update database credentials (name, password, host, port), ensuring they match the CentOS 7 MySQL user settings.
-
Transfer the local
restapi-teachdirectory to/usr/localon the server using XFTP. -
Add the
MySQLdblibrary to/usr/local/Python-3.6.8/lib/python3.6/site-packagesvia XFTP from the local Python 3.6 installation (Lib/site-packages). If missing, install it locally first using:pip3 install mysqlclientNote: Installing
mysqlclientrequires prior installation of wheel dependencies.Dependency link:
https://pypi.org/project/mysqlclient/1.4.4/#files
The
MySQLdbmodule is included withinmysqlclient, so successful installation provides access to it.Additional packages required on CentOS (version critical):
- Django: 2.0.3
- CherryPy: 14.0.0
- Zipp: 3.6.6
- mysqlclient: 1.4.4
- PyMySQL: 1.0.2
Install Django:
pip3 install django==2.0.3Install CherryPy:
pip3 install cherrypy==14.0.0 -
Navigate to
/usr/local/restapi-teach/backendand execute:python project/cherrypy_startup.pyExpected error:
NameError: name '_mysql' is not definedThis occurs due to incompatibility between
MySQLdband Python versions above 3.5. -
In
/usr/local/restapi-teach/backend/project/__init__.py, add the following lines:import pymysql pymysql.install_as_MySQLdb() -
Execute again from
/usr/local/restapi-teach/backend:python project/cherrypy_startup.py -
Open the configured port in the firewall:
sudo firewall-cmd --add-port=3306/tcp --permanent -
Reload firewall rules:
firewall-cmd --reload -
Useful commands:
netstat -tunlp | grep 8086 kill -9 23211 -
Access the application locally via:
http://ip:port/mgr/ps/mgr/index.html/#/
Startup command:
python project/cherrypy_startup.py
Note: It's recommended to use Python 3.6.8 for launching the application. Newer versions may cause plugin compatibility issues. Refer to related documentation for installing Python on CentOS 7 by adjusting version links accordingly.
Future deployments will utilize release packages with Docker manual deployment (combined with deployment environment guides). Some processes are automated or semi-automated, aiming for simpilfied deployment workflows.