본문 바로가기
Research/Network

AWS_No module name 문제

by RIEM 2022. 11. 25.
728x90

레퍼런스

https://stackoverflow.com/questions/59572174/no-module-named-dotenv-python-3-8

문제

AWS에 flask 서버 기반의 프로젝트를 배포했는데 ip로 들어가도 나오지 않았다. 그래서 리눅스에서 app.py 자체를 실행해봤더니 dotenv module 설치가 되지 않아서 되지않음을 알게되었다. 

아래 명령어로 설치를 해주니 정상적으로 잘 작동된다.

python -m pip install python-dotenv
ubuntu@ip-172-31-46-129:~/sparta$ python app.py 
Traceback (most recent call last):
  File "/home/ubuntu/sparta/app.py", line 7, in <module>
    from dotenv import load_dotenv
ModuleNotFoundError: No module named 'dotenv'

ubuntu@ip-172-31-46-129:~/sparta$ python -m pip install python-dotenv
Defaulting to user installation because normal site-packages is not writeable
Collecting python-dotenv
  Downloading python_dotenv-0.21.0-py3-none-any.whl (18 kB)
Installing collected packages: python-dotenv
Successfully installed python-dotenv-0.21.0

ubuntu@ip-172-31-46-129:~/sparta$ python app.py 
 * Serving Flask app 'app'
 * Debug mode: on
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on all addresses (0.0.0.0)
 * Running on http://127.0.0.1:5000
 * Running on http://172.31.46.129:5000
Press CTRL+C to quit
 * Restarting with stat
 * Debugger is active!
 * Debugger PIN: 655-555-060
728x90

댓글