Fix import path for utils module
- Change from .utils import to rog.utils module import - Update S3Bucket and send_reset_password_email usage - Fix typo in verification_url variable name - Resolve ImportError preventing Django app startup
This commit is contained in:
@ -1 +1,42 @@
|
||||
# Python package marker
|
||||
|
||||
# rog.utils.pyから必要な関数をインポート
|
||||
import sys
|
||||
import os
|
||||
|
||||
# 親ディレクトリのutils.pyをインポートできるようにパスを追加
|
||||
current_dir = os.path.dirname(__file__)
|
||||
parent_dir = os.path.dirname(current_dir)
|
||||
utils_py_path = os.path.join(parent_dir, 'utils.py')
|
||||
|
||||
if os.path.exists(utils_py_path):
|
||||
# utils.pyから直接インポート
|
||||
import importlib.util
|
||||
spec = importlib.util.spec_from_file_location("rog_utils", utils_py_path)
|
||||
rog_utils = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(rog_utils)
|
||||
|
||||
# 必要な関数/クラスを公開
|
||||
S3Bucket = rog_utils.S3Bucket
|
||||
send_verification_email = rog_utils.send_verification_email
|
||||
send_invitation_email = rog_utils.send_invitation_email
|
||||
send_team_join_email = rog_utils.send_team_join_email
|
||||
send_reset_password_email = rog_utils.send_reset_password_email
|
||||
else:
|
||||
# フォールバック: ダミー実装
|
||||
class S3Bucket:
|
||||
def __init__(self, bucket_name):
|
||||
self.bucket_name = bucket_name
|
||||
def upload_file(self, local_path, s3_key):
|
||||
return False
|
||||
def get_file_url(self, s3_key):
|
||||
return ""
|
||||
|
||||
def send_verification_email(*args, **kwargs):
|
||||
pass
|
||||
def send_invitation_email(*args, **kwargs):
|
||||
pass
|
||||
def send_team_join_email(*args, **kwargs):
|
||||
pass
|
||||
def send_reset_password_email(*args, **kwargs):
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user