※memorandum
Enter the directory with cd
with terminal
.
Anaconda
↓ Enter the following to move from base
(current location) to the virtual environment (in my case, the created name is py3_aaaa
).
python
$ (base) lancai@oja % source activate py3_aaaa #py3_aaa: Created virtual environment name
↓ Because this development environment is API
uvicorn prog: app --reload --host 0.0.0.0 --port 8100
Enter prog
replaced with api
(below)
python
$ (base) lancai@oja % uvicorn api:app --reload --host 0.0.0.0 --port 8000
This completes the connection!
In the app directory under development ..> src> db> connect.py
,
Check if the set username
and password
are described. If not, add it.
python
from pymongo import MongoClient
#DB connection
def get_connect():
#mongoDB local connection
client = MongoClient("mongodb://(* Username here):(Password here)@localhost:27017/")
#DB used (specify DB)
db = client.(* DB name is entered here)
return db
:terminal:terminal:
$ uvicorn api:app --reload --host 0.0.0.0 --port 8000
① Move to the location where the docker-composer.yml
file of the application under development is placed on the terminal
② ↓ Refer to "cat" at the terminal.
terminal
$ cat docker-compose.yml
③ ↓ environment:
It is described in the part ^ ^
terminal
environment:
MONGODB_USERNAME: *****
MONGODB_PASSWORD: *****
MONGODB_HOSTNAME: *****db
# VIRTUAL_HOST: ""
# LETSENCRYPT_HOST: ""
# LETSENCRYPT_EMAIL: "*********@gmail.com"
Recommended Posts