skip to Main Content

Getting a 500 internal error when attempting to create an apache/django server that runs on digital ocean. After checking the log.error i can see the error below

import pymysql as db
ModuleNotFoundError: No module named pymysql

Within Terminal…

python --version
Python 3.8.5
sudo apt-get install python3-pymysql
python3-pymysql is already the newest version (0.9.3-2ubuntu3).
pip3 install PyMySQL
Requirement already satisfied: PyMySQL in /usr/lib/python3/dist-packages (0.9.3)

Within Python…

import pymysql as db

STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static/')

Any help would be appreciated.

2

Answers


  1. use python -m pip install pymysql

    that used the pip for the Python interpreter you specified as python

    Login or Signup to reply.
  2. sudo systemctl stop gunicorn
    
    source env/bin/activate
    
    python -m pip install pymysql
    
    deactivate
    
    sudo systemctl start gunicorn
    

    works for me.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search