Files
jyls_django/manage.py
2026-01-14 11:01:02 +08:00

31 lines
948 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python
"""Django's command-line utility for administrative tasks."""
# 使用 PyMySQL 替代 mysqlclient必须在导入 Django 之前)
import pymysql
# 覆盖 PyMySQL 的版本信息以满足 Django 4.2+ 的要求
# Django 4.2+ 要求 mysqlclient 2.2.1 或更高版本
pymysql.version_info = (2, 2, 1, "final", 0)
pymysql.install_as_MySQLdb()
import os
import sys
def main():
"""Run administrative tasks."""
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jyls_django.settings')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from exc
execute_from_command_line(sys.argv)
if __name__ == '__main__':
main()