2020년 3월 25일 보안정보 스크래핑

2020년 3월 25일 보안정보 스크래핑 3월 25일 보안정보 스크래핑 ==================================================================== + 주요 취약점 - 메일전송 프로토콜을 이용한 원격 명령어 실행 주의 권고 외 1건 1. 메일전송 프로토콜을 이용한 원격 명령어 실행 주의 권고 최근 OpenSMTPD* 취약점이 발견되는 등 메일전송 프로토콜에서 원격 명령어 실행이 가능하여 주의를 권고함 공격자는 취약점을 악용하여 피해를 발생시킬 수 있으므로, 해결방안을 참고하여 조치 필요 - https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=35302 2. Django 제품 SQL Injection 취약점 보안 업데이트 권고 최근 Django*에서 SQL Injection취약점(CVE-2020-9402)을 악용할 수 있는 개념증명코드(Proof of concept, PoC)가 인터넷상에 공개되어 사용자의 보안 업데이트 필요 - https://www.krcert.or.kr/data/secNoticeView.do?bulletin_writing_sequence=35301 ==================================================================== + 취약점 - Apple Safari 취약점 1. Apple Safari 취약점 Apple Safari security bypass CVE-2020-3885 - https://exchange.xforce.ibmcloud.com/vulnerabilities/178339 Apple Safari security bypass CVE-2020-3887 - https://exchange.xforce.ibmcloud.com/vulnerabilities/178338 Apple Safari inform...

[Django] Django import LOCAL settings 문제.

[Django] Django import LOCAL settings 문제.

Django import LOCAL settings 문제.

원문링크 : https://stackoverflow.com/questions/22904209/django-cannot-import-local-settings

질문 by Brownbay

Django 1.7을 Python 3 에서 구동해 보았다.

그런데, manage.py 를 사용할 때, settings.py 의 import local_settings.py 부분이 문제가 생긴다.

settings.py 를 직접 실행할 때에는 local_settings.py 는 문제없이 임포트된다.

하지만, manage.py 를 실행하면, 아래와 같이 local_settings.py 모듈을 찾을 수 없다고 나온다.

local_settings.py 파일은 settings.py 와 같은 위치에 있다.

무엇이 문제일까?

EDIT: Playing around with Django 1.7... and Python 3

I can't seem to import local_settings.py into my settings.py file when using manage.py.

If I execute the settings.py file directly, my local_settings.py file is imported fine, without any errors.

However, when I run manage.py, it complains that it could not find the local_settings.py module. settings.py and local_settings.py are in the same folder...

Any ideas?

Traceback (most recent call last): File "/home/cg/webdev/riv_com/lib/python3.4/site-packages/django/conf/__init__.py", line 94, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "/usr/lib/python3.4/importlib/__init__.py", line 104, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 2231, in _gcd_import File "", line 2214, in _find_and_load File "", line 2203, in _find_and_load_unlocked File "", line 1200, in _load_unlocked File "", line 1129, in _exec File "", line 1448, in exec_module File "", line 321, in _call_with_frames_removed File "/home/cg/webdev/riv_com/riv_com/riv_com/settings.py", line 79, in from local_settings import * ImportError: No module named 'local_settings'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "./manage.py", line 10, in execute_from_command_line(sys.argv) File "/home/cg/webdev/riv_com/lib/python3.4/site-packages/django/core/management/__init__.py", line 427, in execute_from_command_line utility.execute() File "/home/cg/webdev/riv_com/lib/python3.4/site-packages/django/core/management/__init__.py", line 386, in execute settings.INSTALLED_APPS File "/home/cg/webdev/riv_com/lib/python3.4/site-packages/django/conf/__init__.py", line 46, in __getattr__ self._setup(name) File "/home/cg/webdev/riv_com/lib/python3.4/site-packages/django/conf/__init__.py", line 42, in _setup self._wrapped = Settings(settings_module) File "/home/cg/webdev/riv_com/lib/python3.4/site-packages/django/conf/__init__.py", line 98, in __init__ % (self.SETTINGS_MODULE, e) ImportError: Could not import settings 'riv_com.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named 'local_settings'

답변 by lanzz

Python 3.4는 implicit relative import (암묵적 상대경로 임포트)를 지원하지 않는다. 즉, Python3 에서 from local_settings import * 는 absolute import 절대경로 임포트이기 때문에, sys.path 에서만 local_settings 를 탐색하고, setttings.py 가 있는 디렉토리에서는 탐색경로에 포함되지 않는다. 이를 해결하기 위해선 명시적으로 relative import (상대경로 임포트)임을 알려주면 된다. 즉, from .local_settings import * 와 같이 하면 된다. 이 문법은 Python 2.7 에서도 동작한다.

Python 3.4 does not support implicit relative imports: from local_settings import * in Python 3 is an absolute import and would only search for a local_settings module in your sys.path, but NOT in the same directory where your settings.py module is. You need to use explicit relative import: from .local_settings import *; this would also work in Python 2.7.

Reference: PEP 328

from http://daewonyoon.tistory.com/235 by ccl(S)

댓글

이 블로그의 인기 게시물

엑스브레인(XBrain) 기업 정보

django 설치 방법

[aws] deploy Angular app with s3 | AWS S3로 angular 앱 배포하기