flask-mongo-app
flask-mongo-app copied to clipboard
How do I initialize the DB?
Thanks for the great repository, Chris!
I'm getting an error when I try to sign up as a new user:
File "/var/www/convers.ai/python/flask-mongo-app/run.py", line 118, in register
users = mongo.db.users
AttributeError: 'NoneType' object has no attribute 'users'
I've never worked with MongoDB before. But I suspect it's because my database is empty, i.e. has no columns?
Any command I need to run in order to initialize the database?
The DB itself seems to be working. I successfully ran this:
from pymongo import MongoClient
client = MongoClient(host = ["127.0.0.1:27017"])
client.server_info()
Hi there. Thanks for your message. The live demo uses a MongoDB Atlas service. You might need to set up a free account at MongoDB Atlas to get access to your own database. It should work fine from there.
I have not set up a MongoDB server locally yet, so I’m not sure how to get that to work. As you say, it PyMongo’s MongoClient seemed to connect, I would have thought it was working.
I’ll try this later. Let me know how you get on if you have time.
Thanks again
Chris
On 3 May 2021, at 16:20, leobaumgardt @.***> wrote:
Thanks for the great repository, Chris!
I'm getting an error when I try to sign up as a new user:
File "/var/www/convers.ai/python/flask-mongo-app/run.py", line 118, in register users = mongo.db.users AttributeError: 'NoneType' object has no attribute 'users' I've never worked with MongoDB before. But I suspect it's because my database is empty, i.e. has no columns?
Any command I need to run in order to initialize the database?
The DB itself seems to be working. I successfully ran this:
from pymongo import MongoClient client = MongoClient(host = ["127.0.0.1:27017"]) client.server_info() — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
Hi @leobaumgardt did you get this working? I'm just following up on previous issues. Thanks Chris
DB has connected with this config for me [DEFAULT] SECRET_KEY = secret123 SECURITY_PASSWORD_SALT = x123456 DATABASE_NAME = users MONGO_URI = mongodb://127.0.0.1:27017/users
Thanks for your update. Is it working as expected for you now?
On 4 Jan 2022, at 08:29, Jaggernaut @.***> wrote:
DB has connected with this config for me [DEFAULT] SECRET_KEY = secret123 SECURITY_PASSWORD_SALT = x123456 DATABASE_NAME = users MONGO_URI = mongodb://127.0.0.1:27017/users
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.