Configuring the Teaching Management System on CentOS 7

For testing purposes only.

Project repository: Link (Extraction code: 0000)

Local Environment Setup (Options 1, 2, 3 can be adjusted per requirement)

  1. Modify the port number in rest_api/restapi-teach/backend/project/cherrypy_startup.py (any available port).

  2. To enable session-based authentication before login, change False to True in rest_api/restapi-teach/backend/project/settings_common.py.

  3. 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.
  4. Transfer the local restapi-teach directory to /usr/local on the server using XFTP.

  5. Add the MySQLdb library to /usr/local/Python-3.6.8/lib/python3.6/site-packages via XFTP from the local Python 3.6 installation (Lib/site-packages). If missing, install it locally first using:

    pip3 install mysqlclient
    

    Note: Installing mysqlclient requires prior installation of wheel dependencies.

    Dependency link:

    https://pypi.org/project/mysqlclient/1.4.4/#files

    The MySQLdb module is included within mysqlclient, 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.3
    

    Install CherryPy:

    pip3 install cherrypy==14.0.0
    
  6. Navigate to /usr/local/restapi-teach/backend and execute:

    python project/cherrypy_startup.py
    

    Expected error: NameError: name '_mysql' is not defined

    This occurs due to incompatibility between MySQLdb and Python versions above 3.5.

  7. In /usr/local/restapi-teach/backend/project/__init__.py, add the following lines:

    import pymysql
    pymysql.install_as_MySQLdb()
    
  8. Execute again from /usr/local/restapi-teach/backend:

    python project/cherrypy_startup.py
    
  9. Open the configured port in the firewall:

    sudo firewall-cmd --add-port=3306/tcp --permanent
    
  10. Reload firewall rules:

    firewall-cmd --reload
    
  11. Useful commands:

    netstat -tunlp | grep 8086
    kill -9 23211
    
  12. 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.

Tags: CentOS7 teaching-management-system Django cherrypy MySQL

Posted on Sat, 17 Oct 2026 16:12:56 +0000 by juminoz