/flask-blog

simple blog engine written on Flask

Primary LanguageJavaScriptMIT LicenseMIT

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.