개발 => 복습 후 재정리 대기/AWS

[AWS][Robo3T] 서버 데이터베이스 접속

장 상 현 2021. 5. 10.

https://www.robomongo.org/download

 

Robomongo

Robo 3T: the hobbyist GUI Robo 3T 1.4 brings support for MongoDB 4.2, and a mongo shell upgrade from 4.0 to 4.2, with the ability to manually specify visible databases.   Download Robo 3T Only  

www.robomongo.org

로보 3t 다운로드!

 

설치 - 실행 후

create 클릭!

 

 

 

Name : 내 맘대로 서버 네임

Address : 내 AWS IPv4 주소

 

입력 후 Authentucation 탭 클릭!

 

 

 

Perform authentication 체크 후

 

User Name : 내 맘대로

Password : 내 맘대로

 

후 Test 클릭! 

 

 

 

 

성공! 후에 Save - Connect

 

서버 DB 접속 완료!

 

 

파이참 app.py 코드

from flask import Flask, render_template, jsonify, request
app = Flask(__name__)

from pymongo import MongoClient

# client = MongoClient('localhost', 27017)
client = MongoClient('mongodb://test:test@localhost', 27017)
                      #내가 생성한 id:password
db = client.dbhomework

@app.route('/')
def homework():
   return render_template('index.html')

if __name__ == '__main__':
   app.run('0.0.0.0', port=5000, debug=True)

 

댓글