Comments (17)
i think it dose not work with python3 try this https://github.com/garni-kh/flask-blog
white python3.3 branch
or use python2
from flask-blog.
but....
python -V
Python 2.7.5
囧...
from flask-blog.
sury it is my mistake ,i think your mongoldb version is python version
let see i install it very easy
from flask-blog.
I am counting on you ..
from flask-blog.
i saw my config.py
CONNECTION_STRING = "mongodb://localhost"
just this
uncomment and comment your change and try
from flask-blog.
Because I use auth with mongodb,
so I must type with acc:pwd and /dbname..
or
CONNECTION_STRING = "mongodb://localhost"
show the error message on console
Error type: OperationFailure in file: post.py on line: 28
Error details: database error: not authorized for query on flaskblog.posts
Error type: OperationFailure in file: post.py on line: 101
Error details: command SON([('aggregate', u'posts'), ('pipeline', [{'$unwind': ' $tags'}, {'$group': {'count': {'$sum': 1}, '_id': '$tags'}}, {'$sort': {'count': -1}}, {'$limit': 10}, {'$project': {'count': 1, '_id': 0, 'title': '$_id'}}]), ('cursor', {})]) on namespace flaskblog.$cmd failed: not authorized on flaskblog to execute command { aggregate: "posts", pipeline: [ { $unwind: "$tags" }, { $g roup: { count: { $sum: 1 }, _id: "$tags" } }, { $sort: { count: -1 } }, { $limit : 10 }, { $project: { count: 1, _id: 0, title: "$_id" } } ], cursor: {} }
from flask-blog.
try this
CONNECTION_STRING = "mongodb://acc:pwd@localhost:27017"
from flask-blog.
CONNECTION_STRING = "mongodb://acc:pwd@localhost:27017/dbname
are you forget " in end of line
CONNECTION_STRING = "mongodb://acc:pwd@localhost:27017/dbname"
from flask-blog.
config.py
CONNECTION_STRING = "mongodb://'acc':'pwd'@localhost:27017"
'''Leave this as is if you dont have other configuration'''
#DATABASE = CONNECTION.blog
DATABASE = CONNECTION.'dbname'
or
DATABASE = CONNECTION.blog
#DATABASE = CONNECTION.'dbname'
or
CONNECTION_STRING = "mongodb://'acc':'pwd'@localhost:27017/'dbname'"
DATABASE = CONNECTION.blog
all the same Error Message:
Error type: OperationFailure in file: post.py on line: 28
Error details: command SON([('saslStart', 1), ('mechanism', 'SCRAM-SHA-1'), ('payload', Binary('n,,n=flaskblog,r=MDg0MjU5ODExMzI5OA==', 0)), ('autoAuthorize', 1)]) on namespace admin.$cmd failed: Authentication failed.
Error type: OperationFailure in file: post.py on line: 101
Error details: command SON([('saslStart', 1), ('mechanism', 'SCRAM-SHA-1'), ('payload', Binary('n,,n=flaskblog,r=NzQxMjM5MTUwMzEy', 0)), ('autoAuthorize', 1)]) on namespace admin.$cmd failed: Authentication failed.
mongo with my database and user account info:
use 'dbname'
switched to db 'dbname'
show users
{
"_id" : "'dbname'.'acc'",
"user" : "'acc'",
"db" : "'dbname'",
"roles" : [
{
"role" : 'readWrite',
"db" : "'dbname'"
}
]
}
from flask-blog.
it is my config.py
import pymongo
import os
CONNECTION_STRING = "mongodb://localhost" # replace it with your settings
CONNECTION = pymongo.MongoClient(CONNECTION_STRING)
'''Leave this as is if you dont have other configuration'''
DATABASE = CONNECTION.blog
POSTS_COLLECTION = DATABASE.posts
USERS_COLLECTION = DATABASE.users
SETTINGS_COLLECTION = DATABASE.settings
SECRET_KEY = ""
basedir = os.path.abspath(os.path.dirname(file))
secret_file = os.path.join(basedir, '.secret')
if os.path.exists(secret_file):
# Read SECRET_KEY from .secret file
f = open(secret_file, 'r')
SECRET_KEY = f.read().strip()
f.close()
else:
# Generate SECRET_KEY & save it away
SECRET_KEY = os.urandom(24)
f = open(secret_file, 'w')
f.write(SECRET_KEY)
f.close()
# Modeify .gitignore to include .secret file
gitignore_file = os.path.join(basedir, '.gitignore')
f = open(gitignore_file, 'a+')
if '.secret' not in f.readlines() and '.secret\n' not in f.readlines():
f.write('.secret\n')
f.close()
LOG_FILE = "app.log"
DEBUG = True # set it to False on production
from flask-blog.
so you didn;t create a flask-blog db and user account in mongodb?
I had create a dbname : flaskblog and user name : flaskblog in mongodb...
from flask-blog.
yes ,i think for bloging it didn't necessary you do every think and privilege in blog
from flask-blog.
now i don't have mongodb install ,but this setting work for me.
from flask-blog.
oh oh... Ok... I try to set auth=false in mongodb now and try again...
but hope author or someone can help me to check if can fix the problem ,,, _
from flask-blog.
i try install mongo tomorrow and try agin
from flask-blog.
I stop mongodb then python web.py
Error type: ServerSelectionTimeoutError in file: post.py on line: 28
Error details: localhost:27017: [Errno 111] Connection refused
囧...
i already don't know how to do...
Thank you for help, waiting you...
from flask-blog.
@GH-newbie
Sorry for delayed answer. Big thanks for bug hunting!
Everything should work fine now.
Please try again and open this issue if something goes wrong.
from flask-blog.
Related Issues (14)
- Username is case sensitive HOT 1
- Images failing to appear if being added in short description
- Error message HOT 4
- python 3 compatibility
- SNIMissingWarning on deploying to heroku
- Tables do not render
- Nav bar search input mobile device
- Adding fields to the form and database
- Error
- Typo in input place HOT 1
- Unable to get it working HOT 2
- Error message in file post.py HOT 5
- <code> tag entities
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flask-blog.