Fix: Force PyMySQL usage to resolve Coolify deployment error (2059)
This commit is contained in:
parent
279c717fdd
commit
7b86c4d661
@ -9,13 +9,10 @@ WORKDIR /app
|
|||||||
|
|
||||||
# Install system dependencies
|
# Install system dependencies
|
||||||
# WeasyPrint needs: libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0 libjpeg-dev libopenjp2-7-dev libxcb1
|
# WeasyPrint needs: libpango-1.0-0 libpangoft2-1.0-0 libharfbuzz-subset0 libjpeg-dev libopenjp2-7-dev libxcb1
|
||||||
# MySQLclient needs: default-libmysqlclient-dev gcc pkg-config
|
# PyMySQL does not need libmysqlclient-dev, but we keep basic build tools
|
||||||
# MariaDB Client is added to ensure all authentication plugins (like mysql_native_password) are available for MariaDB 11
|
|
||||||
RUN apt-get update && apt-get install -y \
|
RUN apt-get update && apt-get install -y \
|
||||||
gcc \
|
gcc \
|
||||||
pkg-config \
|
pkg-config \
|
||||||
default-libmysqlclient-dev \
|
|
||||||
mariadb-client \
|
|
||||||
libpango-1.0-0 \
|
libpango-1.0-0 \
|
||||||
libpangoft2-1.0-0 \
|
libpangoft2-1.0-0 \
|
||||||
libharfbuzz-subset0 \
|
libharfbuzz-subset0 \
|
||||||
|
|||||||
@ -0,0 +1,3 @@
|
|||||||
|
import pymysql
|
||||||
|
|
||||||
|
pymysql.install_as_MySQLdb()
|
||||||
@ -8,6 +8,9 @@ https://docs.djangoproject.com/en/5.2/howto/deployment/wsgi/
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import pymysql
|
||||||
|
|
||||||
|
pymysql.install_as_MySQLdb()
|
||||||
|
|
||||||
from django.core.wsgi import get_wsgi_application
|
from django.core.wsgi import get_wsgi_application
|
||||||
|
|
||||||
|
|||||||
@ -16,6 +16,15 @@ class Command(BaseCommand):
|
|||||||
db_conf = settings.DATABASES['default']
|
db_conf = settings.DATABASES['default']
|
||||||
self.stdout.write(f"Debug Info - Host: {db_conf.get('HOST')}, Port: {db_conf.get('PORT')}, Name: {db_conf.get('NAME')}, User: {db_conf.get('USER')}")
|
self.stdout.write(f"Debug Info - Host: {db_conf.get('HOST')}, Port: {db_conf.get('PORT')}, Name: {db_conf.get('NAME')}, User: {db_conf.get('USER')}")
|
||||||
|
|
||||||
|
# DEBUG: Check which MySQLdb is loaded
|
||||||
|
try:
|
||||||
|
import MySQLdb
|
||||||
|
self.stdout.write(f"DEBUG: MySQLdb module is: {MySQLdb}")
|
||||||
|
if hasattr(MySQLdb, '__file__'):
|
||||||
|
self.stdout.write(f"DEBUG: MySQLdb location: {MySQLdb.__file__}")
|
||||||
|
except ImportError:
|
||||||
|
self.stdout.write("DEBUG: MySQLdb module could NOT be imported.")
|
||||||
|
|
||||||
self.stdout.write('Waiting for database...')
|
self.stdout.write('Waiting for database...')
|
||||||
db_conn = None
|
db_conn = None
|
||||||
for i in range(30): # Retry for 30 seconds
|
for i in range(30): # Retry for 30 seconds
|
||||||
|
|||||||
@ -2,6 +2,9 @@
|
|||||||
"""Django's command-line utility for administrative tasks."""
|
"""Django's command-line utility for administrative tasks."""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import pymysql
|
||||||
|
|
||||||
|
pymysql.install_as_MySQLdb()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
Django==5.2.7
|
Django==5.2.7
|
||||||
mysqlclient==2.2.7
|
pymysql
|
||||||
|
cryptography
|
||||||
python-dotenv==1.1.1
|
python-dotenv==1.1.1
|
||||||
Pillow
|
Pillow
|
||||||
weasyprint
|
weasyprint
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user