Giter Site home page Giter Site logo

quokkaproject / quokka Goto Github PK

View Code? Open in Web Editor NEW
2.2K 156.0 450.0 11.28 MB

LOOKING FOR NEW MAINTAINER - Quokka is a Content Management System - `docker run --rm -it -p 5000:5000 quokka/quokka`

Home Page: http://www.quokkaproject.org

License: Other

Makefile 0.59% Python 87.52% HTML 11.20% Dockerfile 0.70%
flask cms content-management content-management-system static-site-generator static-site mongodb tinydb flask-admin cmf

quokka's Introduction

Quokka

quokka

The Happiest CMS in the world

Quokka is a Content Management Framework written in Python.

A lightweight framework to build CMS (Content Management System) as websites, portals, blogs, applications and anything related to publishing content to the web.

Quokka is not limited to CMS area, it is also possible to create Quokka extensions to provide any kind of web application based on Python and Flask.

Quokka can also (optionally) generate a static website from the contents generated in its admin interface.

Features

  • Web based content management admin interface
  • Multiple content formats (markdown, rst, html, plaintext)
  • Compatibility with any of the Pelican Themes
  • Flat file NoSQL database TinyDB or optionally MongoDB for scale deployments
  • Host the Quokka on server or generate a static website
  • Extensible via modules/plugins
  • Powered by Python, Flask, Flask-Admin, TinyMongo and Pelican Themes

Demo

Use this if you want to see how Quokka works

docker run --rm -it -p 5000:5000 quokka/quokka

Go to http://localhost:5000/admin and login using admin/admin

Quick Start

NOTE: QuokkaCMS requires Python 3.6+

To install and run for development mode

Use this if you want to contribute to quokka, PyPi releases will be provided soon.

git clone https://github.com/rochacbruno/quokka
cd quokka
python3 -m venv venv
. venv/bin/activate
pip3 install --upgrade pip
make install
make adduser
make devserver

then access http://localhost:5000 and http://localhost:5000/admin edit the quokka/project_template/quokka.yml and start contributing to the code!

NOTE: In dev mode the project in quokka/project_template/ is used and a database is created inside it.

To install for use/deployment

NOTE: this project is a Work In Progress, consider installing in development mode

python3 -m venv venv
. venv/bin/activate
pip3 install --upgrade pip
pip3 install -e git+https://github.com/rochacbruno/quokka.git#egg=quokka
quokka init mysite
cd mysite
quokka adduser
quokka runserver

Using Quokka CMS

Start a project

$ quokka init NewWebsite --theme=flex --modules=gitpages,heroku
...
🐹 Quokka project created 🐹
πŸ“ Name: NewWebsite
πŸ“ Location: /tmp/newwebsite
πŸ“š Template: default
🎨 Themes: flex theme installed
🚚 Modules: [gitpages, heroku] installed
πŸ”§ Config: Config file written in /tmp/newwebsite/quokka.yml
➑ Go to /tmp/newwebsite
βš™ run `quokka runserver` to start!
πŸ“„ Check the documentation on http://quokkaproject.org
🐹 Happy Quokka! 🐹

YES! it outputs emojis 🐹

The above command will generate your project in myproject folder as:

.
β”œβ”€β”€ databases        # TinyDB database files (gitignored)
β”œβ”€β”€ modules          # Custom modules to load on EXTRA_EXTENSIONS
β”œβ”€β”€ static_build     # output static site
β”œβ”€β”€ themes           # Front-end Themes (Pelican and Quokka Themes supported)
β”œβ”€β”€ uploads          # Media uploaded via admin
β”œβ”€β”€ .gitignore       # gitignore to exclude sensitive files
β”œβ”€β”€ quokka.yml       # Project settings
β”œβ”€β”€ .secrets.yml     # To store keys, tokens and passwords (gitignored)
└── wsgi.py          # To deploy `gunicorn wsgi:app`

You can optionally pass arguments:

Choose existing theme (the default is Malt)

quokka init mywebsite --theme http://github.com/user/theme

Install modules

quokka init mywebsite --theme http://github.com/user/theme --modules="commerce,foo"

the above looks for quokka_commerce and quokka_foo in PyPI and installs it

Set important configurations

quokka init mywebsite --theme http://github.com/user/theme --config="auth_enabled=false"

That is optional, you can to edit quokka.yml to tune your settings.

Create an admin user

quokka adduser

Run your website

quokka runserver --port 5000

Access admin interface

http://localhost:5000/admin

Access your site

http://localhost:5000

Deploy

You can deploy your Quokka Website in a WSGI server

Check the wsgi.py and refer to it when deploying in wsgi servers.

cd myproject
gunicorn wsgi:app -w 4 -b "0.0.0.0:8000"

An example of supervisord config

[program:quokka]
command=/myproject/venv/bin/gunicorn wsgi:app -w 4 -b "0.0.0.0:8000"
directory=/myproject

For more information read Gunicorn documentation

Publish Static HTML website

NOTE: To generate a static website all user management, keys and passwords will be removed from settings.

You can generate a static HTML website to host anywhere

Once you have your website running locally you can easily generate a static HTML website from it.

$ quokka publish --static [--output path]
Generating static HTML website on ./static_build folder

Once you have a ./static_build folder populated with static website you can deploy it using SCP, FTP or git, it is a full static website.

Deploying to github pages from command line

NOTE: You need either ssh key access to github or it will ask login/password

quokka publish --static --git=rochacbruno/mysite --branch=gh_pages

The above is also available in admin under 'publish' menu.

Deploying via SCP

quokka publish --static --scp --dest='me@hostname:/var/www/mysite' [--sshkey ~/.ssh/key] [--password xyz]
password : ...

Deploying to Heroku

This requires heroku client installed, if Procfile is not found it will be generated

quokka publish --static --heroku --options

Deploying via FTP

quokka publish --static --ftp --host='ftp://server.com' --dest='/var/www/mysite'

Load database from remote deployment (only for TinyDB)

When you publish a static website along with the static files the database also goes to the server under the databases/ folder only as a backup and snapshot.

You can load that remote database locally e.g: to add new posts and then re-publish

quokka restoredb --remote --git=rochacbruno/mysite
Creating a backup of local database...
Downloading remote database
Restoring database..
Done...

Now you can run quokka runserver open your localhost:5000/admin write new content and then Publish website again using command line or admin interface.

NOTE: If you want to restore a local database use --local and --path path/to/db

Using MongoDB

You can choose to use MongoDB instead of TinyDB, That is useful specially if you deploy or local instance has more than one admin user concurrently and also useful if you want to install plugins which support MongoDB only (because it relies on aggregations and gridfs)

You only need a running instance of Mongo server and change quokka.yml:DB on your project from:

quokka:
  DB:
    system: tinydb
    folder: databases

to:

quokka:
  DB:
    system: mongodb
    name: my_database
    host: 127.0.0.1
    port: 2600

Then when running quokka again it will try to connect to that Mongo Server.

With that you can deploy your site on wsgi server or can also generate static website.

Running mongo in a Docker container

cd your_quokka_project_folder
docker run -d -v $PWD/databases:/data/db -p 27017:27017 mongo
# wait some seconds until mongo is started
quokka runserver

Contributing to Quokka CMS Development

Do you want to be part of this open-source project?

Take a look at Contributing Guidelines

Setup a contributor environment

Ensure you have Python3.6+ fork this repo and:

git clone https://github.com/$YOURNAME/quokka
cd quokka

# create a Python3.6 virtual env
make create_env

# activate the venv
. venv/bin/activate

# install Quokka in --editable mode (using pbr)
make install

# Create a new admin user
make adduser

# run quokka
make devserver

Access http://localhost:5000/admin and http://localhost

ROADMAP

This list is available on https://github.com/rochacbruno/quokka/issues

This is the list of tasks to be completed until 1.0.0 can be released. support 100% coming only for malt and bootstrap3 themes

Screenshots

The main Admin page

home cms

Pelican themes compatible

An article showing in Malt theme

start contributing to quokka project my site

The same article using Bootstrap 3 theme

start contributing to quokka project my site2

See more on screenshots on #647

Start contributing right now!

quokka's People

Contributors

bendoh avatar bernardoow avatar dhoeric avatar ecliptik avatar lex-quarkie avatar marcosptf avatar redhat-developers-launcher avatar rochacbruno 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  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

quokka's Issues

Flask-BabelEx==0.8.1

No distributions matching the version for pytz (from Flask-BabelEx==0.8.1->-r requirements.txt (line
20))

Markdown in body

I would like to propose to allow Markdown as input for the body text in the admin interface. For instance lepture: http://lab.lepture.com/editor/ is a nice editor for this.

Markdown would separate content and design more, while still allowing the use of HTML. What would be the most convenient way to detect which editor to use? I gave it a class markdown-editor or html-editor.

Implementation is really simple with https://flask-misaka.readthedocs.org/en/latest/ and we can always cache the html output, so no performance loss.

Another advantage is that Markdown is easy to read even without parser. This stored in the database can have strong advantages for the eventual API.

related content

besides of recommendation, would have a way to specify related content.

Render a content in place of channel

In channel, if render_content is selected with a reference to any Content, then this channel url should render the Content detail template/context without redirect.

upload a image error

i uploaded a image (test.jpg).it produced tow images.
test.jpg( it's a fail image)
test_thumb.jpg( it's ok )

windows7 64bit ,python 2.7.3

Control installed modules via database / remove the auto loader for blueprints

I like the auto-load feature, you just drop a module folder and it is done! but it is error prone and I am already having trouble with naming problems.

Now the idea is to keep the folder /modules and the same blueprint structure, but it will not be autoloaded, to load a blueprint it will need to be activated in admin.

When you upload/extract a module in to /modules it will be automatically added to "available modules" but the default state will be inactive, so in admin you need to click in activate button and then it will perform validations, run the tests and check for naming issues.

It is urgent!

python manage.py createsuperuser

hi,i run command:
python manage.py createsuperuser

error information:
Traceback (most recent call last):
File "manage.py", line 52, in
load_blueprint_commands(manager)
File "D:\python_pro\flask_pro\quokka-env\quokka\quokka\ext\blueprints.py", lin
e 94, in load_blueprint_commands
mod = imp.load_module(fname, f, filename, descr)
File "D:\python_pro\flask_pro\quokka-env\quokka\quokka\modules\posts\commands.
py", line 4, in
from .models import Post
ValueError: Attempted relative import in non-package

i found that models.py(quokka/quokka/modules/posts) doesn't compile.

Error 500 while registering but account is created (because of missing SMTP config)

Thats the problem.

Here some log:

30.09 22:49:14 quokka ERROR Exception on /accounts/register [POST]
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Library/Python/2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Library/Python/2.7/site-packages/flask/app.py", line 1461, in dispatch_request
return self.view_functionsrule.endpoint
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/flask_security/views.py", line 117, in register
user = register_user(**form.to_dict())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/flask_security/registerable.py", line 41, in register_user
user=user, confirmation_link=confirmation_link)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/flask_security/utils.py", line 260, in send_mail
mail.send(msg)
File "/Library/Python/2.7/site-packages/flask_mail.py", line 415, in send
with self.connect() as connection:
File "/Library/Python/2.7/site-packages/flask_mail.py", line 123, in enter
self.host = self.configure_host()
File "/Library/Python/2.7/site-packages/flask_mail.py", line 137, in configure_host
host = smtplib.SMTP(self.mail.server, self.mail.port)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 250, in init
(code, msg) = self.connect(host, port)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 310, in connect
self.sock = self._get_socket(host, port, self.timeout)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/smtplib.py", line 285, in _get_socket
return socket.create_connection((host, port), timeout)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 61] Connection refused
30.09 22:49:14 werkzeug INFO 127.0.0.1 - - [30/Sep/2013 22:49:14] "POST /accounts/register HTTP/1.1" 500 -

Module template_folder not working as expected

I know that the blueprint template folder is added to the searchpath of templates but with a lower priority than the actual application’s template folder.

In that way, current post module , has a post folder under templates module to avoid this.

But is not working, also, i just tried to give a unique name(Jinja by default caches a template based on its name) to each module template, without success.

Also remove the template_folder module property and placed the templates under app main templates, without any success.

The only templates that are applied are those under themes.

is this the expected behavoir ?

How is it supposed to work ?

Themes are not supposed to know about modules stuff or they must ?

Set theme by channel

In order to have multi themes in the same website, the idea is to have per channel template/theme configuration.

channel.behaviour = "portal|blog|wiki|app|site"
channel.theme = "foundation_blog"
channel.template_folder = "blablabla"

this way, there is no need to create different apps for those things.

A blog would be just a generic channel configured as a blog.

Version control for content

Thinking on using this with different configurable backends.

  • Database (versions will be stored as collections in db)
  • Git (will use gittle to serialize and store versions to disk/repo)

File upload path error

13.08 23:09:44 quokka       ERROR    Exception on /admin/fileview/new/ [GET]
Traceback (most recent call last):
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/base.py", line 60, in inner
    return f(self, **kwargs)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/base.py", line 60, in inner
    return f(self, **kwargs)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/base.py", line 60, in inner
    return f(self, **kwargs)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/base.py", line 60, in inner
    return f(self, **kwargs)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/model/base.py", line 1079, in create_view
    form = self.create_form()
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/model/base.py", line 660, in create_form
    return self._create_form_class(get_form_data(), obj=obj)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/wtforms/form.py", line 178, in __call__
    return type.__call__(cls, *args, **kwargs)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/form/__init__.py", line 13, in __init__
    super(BaseForm, self).__init__(formdata=formdata, obj=obj, prefix=prefix, **kwargs)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/wtforms/form.py", line 226, in __init__
    super(Form, self).__init__(self._unbound_fields, prefix=prefix)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/wtforms/form.py", line 39, in __init__
    field = unbound_field.bind(form=self, name=name, prefix=prefix, translations=translations)
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/wtforms/fields/core.py", line 314, in bind
    return self.field_class(_form=form, _prefix=prefix, _name=name, _translations=translations, *self.args, **dict(self.kwargs, **kwargs))
  File "/home/rochacbruno/.virtualenvs/quokka-test-1/local/lib/python2.7/site-packages/flask_admin/form/upload.py", line 163, in __init__
    super(FileUploadField, self).__init__(label, validators, **kwargs)
TypeError: __init__() got an unexpected keyword argument 'path'

User Login - Invalid Password

After install, I'm unable to login using the superuser or user accounts. Passwords in the db seem to be stored as plain text [!].

Docs - quokka not in quokka-env

Should the docs say:

~/$ virtualenv quokka-env
~/$ ... creating virtualenv in quokka-env........
~/$ cd quokka-env
~/$ source bin/activate
~/$ git clone https://github.com/rochacbruno/quokka
~/$ ...cloning in to quokka

Or is this just my personal preference? (I like the app to be in the virtualenv which you source).

Multiple authors for content

Each content can have multiple authors.

  • "user" will be the main/origial author.
  • "contributors" will be a reference list of contributors who can edit the content (but not delete)
  • Original author can choose if contributions will be authomatic accept or if it will need to be approved.

Implement prepopulated_fields in channel admin

prepopulated_fields for title/slug is working well when creating a Post, but not when creating a Channel.

Would be good to have it implemented for every content which has a "slug" depending on a "title" field.

I looked the JavaScript used to generate this and I think this can be transformed in a _macro in Jinja2.

Role based access control to posts in admin

in admin the access to content needs to be controlled by role.

by default we have admin, moderator, editor, viewer

  • admin (can access all)
  • moderator (can access all content except administration options)
  • editor (can access only the self-created content or content contributed to
  • viewer (can access all read only)

flask-admin didn't register Channel

information:
15.08 17:10:56 root WARNING admin.register(<\class 'quokka.core.models.C
hannel'>, <class 'quokka.core.models.ChannelAdmin'>, (), {'category': 'Content'}
) error: 'NoneType' object has no attribute 'get'


i updated code in 'quokka/core/models.py'.
now,it works !

old version:
class ChannelAdmin(ModelAdmin):
roles_accepted = ('admin', 'editor')
column_list = ('title', 'long_slug', 'is_homepage', 'published')
column_filters = ['published', 'is_homepage', 'include_in_rss',
'show_in_menu', 'indexable']
column_searchable_list = ('title', 'description')
form_columns = ['title', 'slug', 'description', 'parent', 'is_homepage',
'include_in_rss', 'indexable', 'show_in_menu', 'order',
'published', 'canonical_url', 'values']

new version:
class ChannelAdmin(ModelAdmin):
roles_accepted = ('admin', 'editor')
column_list = ('title', 'long_slug', 'is_homepage', 'published')
column_filters = ['published', 'is_homepage', 'include_in_rss',
'show_in_menu', 'indexable']
column_searchable_list = ('title', 'description')
form_columns = ['title', 'slug', 'description', 'parent', 'is_homepage',
'include_in_rss', 'indexable', 'show_in_menu', 'order',
'published', 'canonical_url']

Settings not generic.

Settings are not generic on first install. (mongodb not localhost, secret key not auto-generated, Flask-Mail settings, etc).

How do we want to handle this? I don't mind the settings file like it is, makes for easier provisioning. However, I like the idea of writing the settings file in a wizard-like way, after bootstrap and with a one-time-use admin account.

layout.html

Where is the layout.html file that is mentioned in (/ templates / admin / base.html)?

per channel/content access control

Implement a general model AccessControl with roles_accepted definition for read/edit/list/delete

This will be applied for Channel and Content

This should have a default api method to check the permission

The generic views and api should call this method to define if access is allowed.

The admin should query the fields to define the access control.

Python 2.6 compatibility

  • Check zero-length in format() replacing "{} {}".format(x, y) with "{0} {1}".format(x, y)
  • Check the instalation of importlib, include in requirements2.6.txt
  • Check the from future import absolute_import

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.