38 lines
944 B
Markdown
38 lines
944 B
Markdown
|
|
# Tutorial
|
||
|
|
## Flask + MongoDB
|
||
|
|
https://www.digitalocean.com/community/tutorials/how-to-use-mongodb-in-a-flask-application
|
||
|
|
## MongoDB install
|
||
|
|
https://www.runoob.com/mongodb/mongodb-window-install.html
|
||
|
|
### MongoDB Shell
|
||
|
|
https://www.mongodb.com/try/download/shell
|
||
|
|
|
||
|
|
# Setup
|
||
|
|
## MongoDB (Windows 11)
|
||
|
|
Install MongoDB.msi
|
||
|
|
Install MongoDB Shell (.zip) copied under the same directory as MongoDB
|
||
|
|
Add the above executables to `PATH`
|
||
|
|
## MongoDB manually startup
|
||
|
|
```
|
||
|
|
mongod --dbpath C:\Users\tripl\codes\smg\db\
|
||
|
|
```
|
||
|
|
|
||
|
|
# On another shell launch the shell
|
||
|
|
```
|
||
|
|
mongosh
|
||
|
|
use flask_db
|
||
|
|
show dbs
|
||
|
|
db.todos.find()
|
||
|
|
.quit
|
||
|
|
```
|
||
|
|
Can also use the MongoDB Compass GUI.
|
||
|
|
|
||
|
|
# Fix
|
||
|
|
## Poetry
|
||
|
|
for powershell move poetry from `"AppData\Roaming\Python\Scripts"` to `"\AppData\Local\Programs\Python\<PythonVersion>\Scripts"`
|
||
|
|
## Poetry shell
|
||
|
|
Now as a plugin
|
||
|
|
`poetry self add poetry-plugin-shell`
|
||
|
|
|
||
|
|
# TODO
|
||
|
|
- properly add mongodb authentication and safely connect with secret saved locally
|