Coder Social home page Coder Social logo

Install problem about flask-blog HOT 17 CLOSED

dmaslov avatar dmaslov commented on July 1, 2024
Install problem

from flask-blog.

Comments (17)

garni-kh avatar garni-kh commented on July 1, 2024

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.

gh-ghost avatar gh-ghost commented on July 1, 2024

but....

python -V
Python 2.7.5

囧...

from flask-blog.

garni-kh avatar garni-kh commented on July 1, 2024

sury it is my mistake ,i think your mongoldb version is python version

let see i install it very easy

from flask-blog.

gh-ghost avatar gh-ghost commented on July 1, 2024

I am counting on you ..

from flask-blog.

garni-kh avatar garni-kh commented on July 1, 2024

i saw my config.py
CONNECTION_STRING = "mongodb://localhost"
just this
uncomment and comment your change and try

from flask-blog.

gh-ghost avatar gh-ghost commented on July 1, 2024

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.

garni-kh avatar garni-kh commented on July 1, 2024

try this
CONNECTION_STRING = "mongodb://acc:pwd@localhost:27017"

from flask-blog.

garni-kh avatar garni-kh commented on July 1, 2024

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.

gh-ghost avatar gh-ghost commented on July 1, 2024

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.

garni-kh avatar garni-kh commented on July 1, 2024

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.

gh-ghost avatar gh-ghost commented on July 1, 2024

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.

garni-kh avatar garni-kh commented on July 1, 2024

yes ,i think for bloging it didn't necessary you do every think and privilege in blog

from flask-blog.

garni-kh avatar garni-kh commented on July 1, 2024

now i don't have mongodb install ,but this setting work for me.

from flask-blog.

gh-ghost avatar gh-ghost commented on July 1, 2024

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.

garni-kh avatar garni-kh commented on July 1, 2024

i try install mongo tomorrow and try agin

from flask-blog.

gh-ghost avatar gh-ghost commented on July 1, 2024

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.

dmaslov avatar dmaslov commented on July 1, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.