mirror of
https://github.com/openwrt/packages.git
synced 2025-12-19 09:01:22 +00:00
django1: Fix byte-compiled db migrations not loaded
This patches Django to load byte-compiled (.pyc) db migration scripts, since Python scripts are often distributed in byte-compiled form in OpenWrt packages. Signed-off-by: Jeffery To <jeffery.to@gmail.com>
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
--- a/django/db/migrations/loader.py
|
||||
+++ b/django/db/migrations/loader.py
|
||||
@@ -106,7 +106,7 @@ class MigrationLoader(object):
|
||||
# Scan for .py files
|
||||
migration_names = set()
|
||||
for name in os.listdir(directory):
|
||||
- if name.endswith(".py"):
|
||||
+ if name.endswith(".py") or name.endswith(".pyc"):
|
||||
import_name = name.rsplit(".", 1)[0]
|
||||
if import_name[0] not in "_.~":
|
||||
migration_names.add(import_name)
|
||||
Reference in New Issue
Block a user