mirror of
https://github.com/DMOJ/online-judge.git
synced 2024-11-25 16:32:37 +08:00
Remove Django 2.2 file
This commit is contained in:
parent
69d5907631
commit
3914dec21c
@ -1,17 +0,0 @@
|
||||
import django
|
||||
from django.utils.encoding import force_str
|
||||
|
||||
if (2, 2) <= django.VERSION < (3,):
|
||||
# Django 2.2.x is incompatible with PyMySQL.
|
||||
# This monkey patch backports the Django 3.0+ code.
|
||||
|
||||
from django.db.backends.mysql.operations import DatabaseOperations
|
||||
|
||||
def last_executed_query(self, cursor, sql, params):
|
||||
# With MySQLdb, cursor objects have an (undocumented) "_executed"
|
||||
# attribute where the exact query sent to the database is saved.
|
||||
# See MySQLdb/cursors.py in the source distribution.
|
||||
# MySQLdb returns string, PyMySQL bytes.
|
||||
return force_str(getattr(cursor, '_executed', None), errors='replace')
|
||||
|
||||
DatabaseOperations.last_executed_query = last_executed_query
|
@ -9,6 +9,4 @@ gevent.monkey.patch_all()
|
||||
import dmoj_install_pymysql # noqa: E402, F401, I100, I202, imported for side effect
|
||||
|
||||
from django.core.wsgi import get_wsgi_application # noqa: E402, I100, I202, django must be imported here
|
||||
# noinspection PyUnresolvedReferences
|
||||
import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect
|
||||
application = get_wsgi_application()
|
||||
|
@ -11,9 +11,6 @@ import dmoj_install_pymysql # noqa: E402, F401, I100, I202, imported for side e
|
||||
import django # noqa: E402, F401, I100, I202, django must be imported here
|
||||
django.setup()
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect
|
||||
|
||||
from judge.bridge.daemon import judge_daemon # noqa: E402, I100, I202, django code must be imported here
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
@ -8,8 +8,5 @@ except ImportError:
|
||||
# set the default Django settings module for the 'celery' program.
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings')
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
import django_2_2_pymysql_patch # noqa: E402, I100, F401, I202, imported for side effect
|
||||
|
||||
# noinspection PyUnresolvedReferences
|
||||
from dmoj.celery import app # noqa: E402, F401, imported for side effect
|
||||
|
@ -11,7 +11,4 @@ if __name__ == '__main__':
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dmoj.settings')
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
# noinspection PyUnresolvedReferences
|
||||
import django_2_2_pymysql_patch # noqa: F401, imported for side effect
|
||||
|
||||
execute_from_command_line(sys.argv)
|
||||
|
Loading…
Reference in New Issue
Block a user