Added extension registry
This commit is contained in:
parent
aeb3d32132
commit
a2fe635dd8
8 changed files with 148 additions and 1 deletions
|
|
@ -23,8 +23,10 @@ def remove_db_session(response):
|
|||
from flask_website.views.general import general
|
||||
from flask_website.views.mailinglist import mailinglist
|
||||
from flask_website.views.snippets import snippets
|
||||
from flask_website.views.extensions import extensions
|
||||
app.register_module(general)
|
||||
app.register_module(mailinglist)
|
||||
app.register_module(snippets)
|
||||
app.register_module(extensions)
|
||||
|
||||
from flask_website.database import User, db_session
|
||||
|
|
|
|||
BIN
flask_website/static/extensions.png
Normal file
BIN
flask_website/static/extensions.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
|
|
@ -16,6 +16,7 @@ pre { padding: 7px 30px; margin: 15px -30px; line-height: 1.3; }
|
|||
p { line-height: 1.4; }
|
||||
ul { margin: 15px 0 15px 0; padding: 0; list-style: none; line-height: 1.4; }
|
||||
ul li:before { content: "\00BB \0020"; color: #888; position: absolute; margin-left: -19px; }
|
||||
ol { line-height: 1.4; margin: 15px 0 15px 30px; padding: 0; }
|
||||
blockquote { margin: 0; font-style: italic; color: #444; }
|
||||
.footer { font-size: 13px; color: #888; text-align: right; margin-top: 25px; }
|
||||
.nav { text-align: center; }
|
||||
|
|
@ -70,6 +71,12 @@ input.openid { background: url(openid.png) no-repeat 4px center;
|
|||
.mail .quote { color: #004B6B; }
|
||||
.mail .sig { color: #888; }
|
||||
|
||||
/* extensions */
|
||||
.extension div.description p { margin: 10px 0; }
|
||||
.extension dl { margin: 0; font-size: 0.9em; }
|
||||
.extension dl dt { width: 130px; float: left; height: 22px; }
|
||||
.extension dl dd { height: 22px; }
|
||||
|
||||
/* pygments style, same as flaskystyle */
|
||||
.hll { background-color: #ffffcc }
|
||||
.c { color: #8f5902; font-style: italic } /* Comment */
|
||||
|
|
|
|||
38
flask_website/templates/extensions/creating.html
Normal file
38
flask_website/templates/extensions/creating.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{% extends "extensions/layout.html" %}
|
||||
{% block title %}Creating Extensions{% endblock %}
|
||||
{% block body %}
|
||||
<h2>Creating Extensions</h2>
|
||||
<p>
|
||||
Extensions to Flask are regular Python packages. But there are some
|
||||
rules you should/must follow so that we can enlist your extension on
|
||||
the Flask extension registry:
|
||||
<ol>
|
||||
<li>
|
||||
Your extension must be placed in a <code>flaskext.</code>
|
||||
namespace package. This makes it easier for others to locate
|
||||
your extension and does not clutter the PyPI index with generic
|
||||
toplevel packages.
|
||||
<li>
|
||||
Your extension should have the word “Flask” in the name. This
|
||||
makes it easier to locate all the packages that go well with
|
||||
Flask. This is also how the moderators of the extension registry
|
||||
spot your extension.
|
||||
<li>
|
||||
The extension should be documented with Sphinx and it's recommended
|
||||
to use intersphinx to interlink the documentation with Flask itself
|
||||
and other extensions it might depend on. It's also recommended to use
|
||||
the <a href="http://github.com/mitsuhiko/flask-sphinx-themes">Flask
|
||||
Sphinx Themes</a> or a modified version of one of them.
|
||||
<li>
|
||||
Extensions should have proper dependencies in the <em>setup.py</em>
|
||||
file specified so that installation with pip/easy_install works.
|
||||
<li>
|
||||
Ideally your extension has at least one example in the repository
|
||||
or tarball so that it's easier to understand how it works.
|
||||
</ol>
|
||||
<p>
|
||||
We scan the PyPI index in regular intervals for new Flask packages
|
||||
so your extension should sooner or later end up here. If this is
|
||||
not quick enough for you, send <a
|
||||
href="mailto:armin.ronacher@active-4.com">me a mail</a>.
|
||||
{% endblock %}
|
||||
36
flask_website/templates/extensions/index.html
Normal file
36
flask_website/templates/extensions/index.html
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
{% extends "extensions/layout.html" %}
|
||||
{% block title %}Extensions Registry{% endblock %}
|
||||
{% block body %}
|
||||
<p>
|
||||
Welcome to the Flask extensions registry. Here you can find a list
|
||||
of packages that extend Flask. This list is moderated and updated
|
||||
on a regular basis. If you want your package to show up here,
|
||||
follow the <a href="{{ url_for('creating') }}">guide on creating
|
||||
extensions</a>.
|
||||
{% for extension in extensions %}
|
||||
<div class=extension>
|
||||
<h2>{{ extension.name }}</h2>
|
||||
<div class=description>
|
||||
{{ extension.description }}
|
||||
</div>
|
||||
<dl>
|
||||
<dt>Author:
|
||||
<dd>{{ extension.author }}
|
||||
<dt>PyPI Page:
|
||||
<dd><a href="{{ extension.pypi }}">{{ extension.name }}</a>
|
||||
{% if extension.website %}
|
||||
<dt>Website:
|
||||
<dd>{{ extension.website|urlize }}
|
||||
{% endif %}
|
||||
{% if extension.docs %}
|
||||
<dt>Documentation:
|
||||
<dd><a href="{{ extension.docs }}">Read docs @ {{ extension.docserver }}</a>
|
||||
{% endif %}
|
||||
{% if extension.github %}
|
||||
<dt>On Github:
|
||||
<dd><a href="http://github.com/{{ extension.github }}">{{ extension.github }}</a>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
10
flask_website/templates/extensions/layout.html
Normal file
10
flask_website/templates/extensions/layout.html
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{% extends "layout.html" %}
|
||||
{% block head %}
|
||||
{{ super() }}
|
||||
<style type=text/css>
|
||||
h1 { background-image: url(/static/extensions.png); }
|
||||
</style>
|
||||
{% endblock %}
|
||||
{% block body_title %}
|
||||
<h1><span>Flask Extensions</span></h1>
|
||||
{% endblock %}
|
||||
|
|
@ -14,7 +14,8 @@
|
|||
<a href=/>overview</a> //
|
||||
<a href=/docs/>documentation</a> //
|
||||
<a href=/mailinglist/>mailinglist</a> //
|
||||
<a href=/snippets/>snippets</a>
|
||||
<a href=/snippets/>snippets</a> //
|
||||
<a href=/extensions/>extensions</a>
|
||||
{% for message in get_flashed_messages() %}
|
||||
<p class=message>{{ message }}
|
||||
{% endfor %}
|
||||
|
|
|
|||
53
flask_website/views/extensions.py
Normal file
53
flask_website/views/extensions.py
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
from urlparse import urlparse
|
||||
from flask import Module, render_template, Markup
|
||||
from werkzeug import url_quote
|
||||
|
||||
extensions = Module(__name__, url_prefix='/extensions')
|
||||
|
||||
class Extension(object):
|
||||
|
||||
def __init__(self, name, author, description,
|
||||
github=None, docs=None, website=None):
|
||||
self.name = name
|
||||
self.author = author
|
||||
self.description = Markup(description)
|
||||
self.github = github
|
||||
self.docs = docs
|
||||
self.website = website
|
||||
|
||||
@property
|
||||
def pypi(self):
|
||||
return 'http://pypi.python.org/pypi/%s' % url_quote(self.name)
|
||||
|
||||
@property
|
||||
def docserver(self):
|
||||
if self.docs:
|
||||
return urlparse(self.docs)[1]
|
||||
|
||||
database = [
|
||||
Extension('Flask-OAuth', 'Armin Ronacher',
|
||||
description='''
|
||||
<p>Adds <a href="http://oauth.net/">OAuth</a> support to Flask.
|
||||
''',
|
||||
github='mitsuhiko/flask-oauth',
|
||||
docs='http://packages.python.org/Flask-OAuth'
|
||||
),
|
||||
Extension('Flask-OpenID', 'Armin Ronacher',
|
||||
description='''
|
||||
<p>Adds <a href="http://openid.net/">OpenID</a> support to Flask.
|
||||
''',
|
||||
github='mitsuhiko/flask-openid',
|
||||
docs='http://packages.python.org/Flask-OpenID'
|
||||
)
|
||||
]
|
||||
database.sort(key=lambda x: x.name.lower())
|
||||
|
||||
|
||||
@extensions.route('/')
|
||||
def index():
|
||||
return render_template('extensions/index.html', extensions=database)
|
||||
|
||||
|
||||
@extensions.route('/creating/')
|
||||
def creating():
|
||||
return render_template('extensions/creating.html')
|
||||
Loading…
Add table
Add a link
Reference in a new issue