Week 9 — Uploading…
Let Us Finally Upload Our Projects to the Server
--
Now, let us finally upload our project.
First of all, using Robo3T, access your MongoDB and then click the icon on the upper left corner. There, click “Create” as shown below.
Now, finish setting up your information.
Then, on the “Authentication” tab:
- Click the “Perform Authentication” checkbox
- Input your ID/PW and click “Save”
Now, let us upload our project to EC2 using FileZilla. I used the project below:
Before uploading, we need to modify our code so it reflects the ID/PW feature. Replace this code -
client = MongoClient('mongodb://test:test@localhost', 27017)
-with this one:
client = MongoClient('mongodb://ID:PW@localhost', 27017)
Now, upload the folder to the home/ubuntu folder. Let us try running the python:
# go to the home directory
cd ~# go to the respective folder and run the code
python app.py
There should be an error, and this is because we haven’t installed the pymongo package. Install it by inserting this code:
pip install pymongo
Run again and access it via:
http://[myAWSIP]:5000/
Should work!
Fin.