GithubHelp home page GithubHelp logo

flask-blog's Introduction

flask-blog

simple blog engine written on Flask

Demo:

you can try it here

login:demo

pass:demo

Under the hood:

What it can:

  • create/preview/update/delete articles;
  • create/update/delete users;
  • search;
  • atom feed.

It contains:

Requirements:

  • mongoDB >= 2.2

Installation:

git clone https://github.com/dmaslov/flask-blog.git

cd flask-blog

virtualenv --no-site-packages ./env

source ./env/bin/activate

pip install -r requirements.txt

After this edit the config.py file

  • Replace the CONNECTION_STRING variable with your own connection string;

  • Replace the DATABASE variable to your own one;

  • If the default collection names don't work for you please replace the POSTS_COLLECTION, USERS_COLLECTION and USERS_COLLECTION variables to any names you like;

  • If you use this code on a production sever replace the DEBUG variable with False.

Run:

Start mongod, then when you in project dir with actived environment just type in terminal

python web.py

builtin_run

or

gunicorn web:app

gunicorn_run

Usage:

When you run the application for the first time the "Install" page appears. You need to create a user profile and set some display settings on this page.

install_page

If you have an account on Gravatar and your logged-in email links to it, the userpic will display. It will be a random gravatar image if it doesn't.

All necessary MongoDB indexes will be created during the installation. A test text post will be created as well.

There should be at least one post and one user for the database to be installed. That is why it's impossible to delete the last post or user.

If you want to start it from scratch please remove all existing collections from your database and delete the browser session cookie. The Install page will show up again.

For deploying you can use Heroku and mongolab for example.

If you are using mongolab, please copy the outlined on the screenshot line to connect using driver, type in your dbuser and dbpassword and paste the line into the CONNECTION_STRING variable in the config.py file.

mongolab_databases

For Heroku you'll find gunicorn server in the requirements.txt file. You are welcome to see how to deploy a Python web application on Heroku here.

WYSIWYG editor:

WYSIWYG editor uses Markdown. Only available on the editor panel tags are intepreted.

wysiwyg_editor_panel

The editor is based on MDMagick project.

To insert any tag you need to SELECT a word and then click on a needed tag on the editor panel.

You can insert github Gists.

For this click on the Gist tag on the panel, copy the gist id from the github gists page and paste it to the dialog window.

The word will be replaced with a working gist tag.

gist_page

inser_gist

To insert an image you also need to select a word that will be used like a title attribute and paste the image URL into the dialog window.

insert_image

Upd:

Don't need to highlight text to add a link or an image anymore. Now you can simply click some tag in the editor menu and put a link. The 'Markdown' tag will be created automatically with a highlighted temporary description. The existing pasting algorithm works as it did before.

flask-blog's People

Contributors

bhsaurabh avatar dmaslov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flask-blog's Issues

python 3 compatibility

Hi there, the python_3 branch does not appear to be fully compatible with python 3.
Below is a on the python_3 branch

Traceback (most recent call last):
  File "web.py", line 10, in <module>
    import post
  File "/home/gkuhn/flask-blog/post.py", line 45
    except Exception, e:
                ^
SyntaxError: invalid syntax

Error

web.py:5: DeprecationWarning: 'etree' is deprecated. Use 'xml.etree.ElementTree' instead.
from mdx_github_gists import GitHubGistExtension
web.py:8: DeprecationWarning: 'etree' is deprecated. Use 'xml.etree.ElementTree' instead.
from mdx_code_multiline import MultilineCodeExtension
Traceback (most recent call last):
File "web.py", line 9, in
from werkzeug.contrib.atom import AtomFeed
ModuleNotFoundError: No module named 'werkzeug.contrib'

Install problem

Dear Sir:

ใ€€I install this on CentOS 7 and mongodb 3.0x,
when I python web.py, show error message in console:

//
Error type: TypeError in file: post.py on line: 103
Error details: list indices must be integers, not str
//

After I try to create a user account on Web,
it error with "create user user error" and error message in console

//
Error type: TypeError in file: user.py on line: 152
Error details: init() got an unexpected keyword argument 'safe'
//

My config in config.py:

//

CONNECTION_STRING = "mongodb://localhost" # replace it with your settings

CONNECTION_STRING = "mongodb://acc:pwd@localhost:27017/dbname

DATABASE = CONNECTION.blog

DATABASE = CONNECTION.dbname
//

How should I fix the problem?

Thank you

Adding fields to the form and database

Awesome project! I would like to add extra fields to the form and to the database. I am familiar with flask-migrate and the use of a model.py, but this project is not using flask-migrate how would I go about adding fields with your project??

Error message in file post.py

Got a error when I run python web.py runserver

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'}}])]) failed: no such cmd: aggregate

But it seems everything works fine after it's installed.

Error message

I come again ...Orz

I update post.py, user.py , web.py, then python web.py.
I type the web ip and saw the error message:

TypeError: 'NoneType' object has no attribute 'getitem'
Traceback (most recent call last)

File "/flask-blog/env/lib/python2.7/site-packages/flask/app.py", line 1836, in __call__

return self.wsgi_app(environ, start_response)

File "/flask-blog/env/lib/python2.7/site-packages/flask/app.py", line 1825, in wsgi_app

ctx.auto_pop(error)

File "/flask-blog/env/lib/python2.7/site-packages/flask/ctx.py", line 370, in auto_pop

(exc is not None and self.app.preserve_context_on_exception):

File "/flask-blog/env/lib/python2.7/site-packages/flask/app.py", line 559, in preserve_context_on_exception

rv = self.config['PRESERVE_CONTEXT_ON_EXCEPTION']

TypeError: 'NoneType' object has no attribute '__getitem__'

Anything I did wrong?

SNIMissingWarning on deploying to heroku

On deployment heroku builds it successfully and makes a HTTPS request , but the SNI (Subject Name Indication) extension to TLS is not available on python-2.7.4 This may cause the server to present an incorrect TLS certificate, which can cause validation failures. Thus I changed what was in runtime.txt to python-2.7.11 but I get Internal Server Error after clean deployment.

The flask-blog is using certifi, pyopenssl ndg-httpsclient pyasn1, urllib3[secure] and cryptography to enable HTTPS verification. I am lost what might be the problem?
requirements.txt
config.py.txt
Procfile.txt

Username is case sensitive

When logging into the demo app "Demo" is not a valid us while "demo" is. Mostly an annoyance on mobile as most touchscreen keyboards auto capitalize the first character typed.

To fix it try (strip is added for the same reason with mobile keyboards and whitespace) :

username.lower().strip()

Tables do not render

Tables written in markdown do not render. This can be tested with this:

Tables Are Cool
col 3 is right-aligned $1600
col 2 is centered $12
zebra stripes are neat $1

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.