Website update. There is now a community section.

This commit is contained in:
Armin Ronacher 2010-05-18 17:56:51 +02:00
parent 33bb6dec37
commit 2fb50e55d9
28 changed files with 1441 additions and 33 deletions

View file

@ -33,10 +33,12 @@ app.add_url_rule('/docs/flask-docs.zip', endpoint='docs.zip',
build_only=True) build_only=True)
from flask_website.views.general import general from flask_website.views.general import general
from flask_website.views.community import community
from flask_website.views.mailinglist import mailinglist from flask_website.views.mailinglist import mailinglist
from flask_website.views.snippets import snippets from flask_website.views.snippets import snippets
from flask_website.views.extensions import extensions from flask_website.views.extensions import extensions
app.register_module(general) app.register_module(general)
app.register_module(community)
app.register_module(mailinglist) app.register_module(mailinglist)
app.register_module(snippets) app.register_module(snippets)
app.register_module(extensions) app.register_module(extensions)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

File diff suppressed because it is too large Load diff

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 208 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 72 KiB

View file

@ -6,8 +6,8 @@ h2, h3 { font-family: 'Garamond', 'Georgia', serif; font-weight: normal; }
h1 { margin: 0 0 30px 0; background: url(/static/flask.png) no-repeat center; h1 { margin: 0 0 30px 0; background: url(/static/flask.png) no-repeat center;
height: 165px; } height: 165px; }
h1 span { display: none; } h1 span { display: none; }
h2 { font-size: 28px; margin: 15px 0 5px 0; } h2 { font-size: 30px; margin: 15px 0 5px 0; }
h3 { font-size: 22px; margin: 15px 0 5px 0; } h3 { font-size: 24px; margin: 15px 0 5px 0; }
textarea, code, textarea, code,
pre { font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', pre { font-family: 'Consolas', 'Menlo', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono',
monospace!important; font-size: 15px; background: #eee; } monospace!important; font-size: 15px; background: #eee; }
@ -19,6 +19,7 @@ ul li:before { content: "\00BB \0020"; color: #888; position: absolute; margin-l
ol { line-height: 1.4; margin: 15px 0 15px 30px; padding: 0; } ol { line-height: 1.4; margin: 15px 0 15px 30px; padding: 0; }
blockquote { margin: 0; font-style: italic; color: #444; } blockquote { margin: 0; font-style: italic; color: #444; }
.footer { font-size: 13px; color: #888; text-align: right; margin-top: 25px; } .footer { font-size: 13px; color: #888; text-align: right; margin-top: 25px; }
.more { text-align: right; margin-top: 0; font-size: 0.9em; font-style: italic; }
.nav { text-align: center; } .nav { text-align: center; }
.nav a { font-style: italic; } .nav a { font-style: italic; }
.backnav { float: right; color: #444; font-style: italic; .backnav { float: right; color: #444; font-style: italic;
@ -40,6 +41,10 @@ th { background: #eee; font-weight: normal; }
td input { border: none; padding: 0; } td input { border: none; padding: 0; }
/* latest version button */
.latestver { margin: 20px 0 0 0; float: right; font-style: italic; }
.latestver strong { font-weight: normal; }
/* forms */ /* forms */
input, textarea, select { border: 1px solid black; padding: 2px; background: white; input, textarea, select { border: 1px solid black; padding: 2px; background: white;
font-family: 'Georgia', serif; font-size: 17px; color: #004B6B; } font-family: 'Georgia', serif; font-size: 17px; color: #004B6B; }
@ -52,6 +57,13 @@ input.openid { background: url(openid.png) no-repeat 4px center;
padding-left: 26px; } padding-left: 26px; }
.formlist dt { color: #004B6B; margin: 8px 0; } .formlist dt { color: #004B6B; margin: 8px 0; }
/* badges */
.badge { margin: 15px -30px; padding: 0 30px;
border: 1px solid #eee; }
.badge p { margin: 0; padding: 10px 0; line-height: 0; }
.badge img { margin: 0; }
.badge pre { margin: 0 -30px; padding: 5px 30px; }
/* snippets */ /* snippets */
.snippet-author { margin: 0 0 20px 0; font-size: 0.9em; } .snippet-author { margin: 0 0 20px 0; font-size: 0.9em; }
#comment-box { background: #fafafa; margin: 45px -30px 15px -30px; padding: 10px 30px; } #comment-box { background: #fafafa; margin: 45px -30px 15px -30px; padding: 10px 30px; }

View file

@ -0,0 +1,12 @@
{% macro tweet_box(tweets, limit=none) %}
<div class=twitter>
<ul>
{%- for tweet in tweets.get(limit) %}
<li>
<a href="http://twitter.com/{{ tweet.user }}">{{ tweet.user }}</a>:
{{ tweet.text|urlize }}
<span class=meta>&mdash; {{ tweet.pub_date|timedeltaformat }} ago via {{ tweet.via }}</span>
{%- endfor %}
</ul>
</div>
{% endmacro %}

View file

@ -0,0 +1,32 @@
{% extends "community/layout.html" %}
{% block title %}Badges{% endblock %}
{% macro badge(filename, title) -%}
<a href="{{ url_for('general.index', _external=true) }}"><img
src="{{ url_for('.static', filename='badges/' ~ filename, _external=true) }}"
border="0"
alt="{{ title }}"
title="{{ title }}"></a>
{%- endmacro %}
{% macro show_badge(filename, title) -%}
<div class=badge>
<p>{{ badge(filename, title) }}
<pre>{{ badge(filename, title)|forceescape }}</pre>
</div>
{%- endmacro %}
{% block body %}
<h2>Badges</h2>
<p>
If you want to share the word and want to add a “powered by
Flask” badge to your website you can display one of these
nifty badges. We also have some badges if your website is not
yet powered by Flask :)
<h3>Large Badges</h3>
{{ show_badge('flask-powered.png', 'Flask powered') }}
{{ show_badge('i-wish.png', 'I wish this site were Flask powered') }}
{{ show_badge('unfortunately-not.png', 'Unfortunately not Flask powered') }}
<h3>Small Badges</h3>
{{ show_badge('flask-project-s.png', 'a Flask project') }}
{{ show_badge('made-with-flask-s.png', 'made with Flask') }}
{{ show_badge('powered-by-flask-s.png', 'powered by Flask') }}
<p><small>Idea for badges inspired by the Django Framework badges.</small></p>
{% endblock %}

View file

@ -0,0 +1,21 @@
{% extends "community/layout.html" %}
{% block body %}
<p>
Even though Flask is a rather new project, there has already a healty
community evolved around it. There is an active
<a href="{{ url_for('mailinglist.index') }}">mailinglist</a> both for
developers using Flask as well as working on the core, and an
<a href="{{ url_for('community.irc') }}">IRC</a> channel.
<p>
If you want to spread the word, there is also a selection of
<a href="{{ url_for('community.badges') }}">badges</a> and
<a href="{{ url_for('community.logos') }}">logos</a> you can use
on your own website.
<ul>
<li><a href="{{ url_for('mailinglist.index') }}">Mailinglist</a>
<li><a href="{{ url_for('community.irc') }}">IRC Channel</a>
<li><a href="{{ url_for('community.twitter') }}">Flask on Twitter</a>
<li><a href="{{ url_for('community.badges') }}">Badges</a>
<li><a href="{{ url_for('community.logos') }}">Logos</a>
</ul>
{% endblock %}

View file

@ -0,0 +1,26 @@
{% extends "community/layout.html" %}
{% block title %}IRC Channel{% endblock %}
{% block body %}
<h2>IRC Channel</h2>
<p>
The Flask IRC channel is <code>#pocoo</code> on irc.freenode.net.
Flask shares that channel with other Pocoo projects, so please
let the others know that you are talking about Flask when asking
a question.
<p>
You can use any IRC client to connect to freenode. If you don't
have one yet, pick one from the list:
<ul>
<li><a href="http://pidgin.im/">Pidgin</a>, Windows, Linux, OS X
<li><a href="http://xchat.org/">X-Chat</a>, Linux
<li><a href="http://mirc.com/">mirc</a>, Windows
<li><a href="http://colloquy.info/">colloquy</a>, OS X
</ul>
<p>
Alternatively you can also use the freenode web interface to
join the IRC channel: <a href="http://bit.ly/pocooirc">open
#pocoo in your browser</a>.
<p>
If you want to read up on older discussions you can access
the IRC logs on <a href=http://dev.pocoo.org/irclogs/>dev.pocoo.org/irclogs</a>.
{% endblock %}

View file

@ -0,0 +1,10 @@
{% extends "layout.html" %}
{% block head %}
{{ super() }}
<style type=text/css>
h1 { background-image: url({{ url_for('.static', filename='community.png') }}); }
</style>
{% endblock %}
{% block body_title %}
<h1><span>Flask Community</span></h1>
{% endblock %}

View file

@ -0,0 +1,27 @@
{% extends "community/layout.html" %}
{% block title %}Logos{% endblock %}
{% macro logo(format) -%}
<a href="{{ url_for('.static', filename='logo/flask.' ~ format)
}}">{{ format|upper }} format</a>
{%- endmacro %}
{% block body %}
<h2>Logos</h2>
<p>
The Flask logo is available for download and use in the formats
below. You can use the logo to promote Flask like you want.
The image is licensed under the Creative Commons
“Attribution-No Derivative Works 3.0 Austria” license.
<a href="http://creativecommons.org/licenses/by-nd/3.0/at/deed.en"
>Read license text</a>.
<ul>
<li>{{ logo('png') }}: for online and screen usage
<li>{{ logo('svg') }}: for online and screen usage
<li>{{ logo('eps') }}: for print use
<li>{{ logo('pdf') }}: for print use
</ul>
<p>
The font used in the logo is “Hightower Text roman” from the
Font Bureau foundry. The font can be purchased from
<a href="http://www.ascenderfonts.com/font/hightower-text-roman.aspx"
>Ascender Fonts</a>.
{% endblock %}

View file

@ -0,0 +1,23 @@
{% extends "community/layout.html" %}
{% from "_twitter.html" import tweet_box %}
{% block head %}
{{ super() }}
{% endblock %}
{% block body %}
<h2>Twitter</h2>
<p>
Currently there is no dedicated Twitter account for updates
regarding Flask, but here are some accounts that you might
want to follow:
<ul>
<li><a href="http://twitter.com/mitsuhiko">@mitsuhiko</a> &mdash;
development lead
<li><a href="http://twitter.com/PocooProject">@PocooProject</a> &mdash;
official Pocoo Project account
</ul>
<h3>Recent Tweets</h3>
<p>
Here some aggregated tweets from various people all over the planet
mentioning Flask:
{{ tweet_box(tweets, 15) }}
{% endblock %}

View file

@ -1,11 +1,14 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% from "_twitter.html" import tweet_box %}
{% set latest_version = '0.2' %}
{% set download_url = 'http://pypi.python.org/packages/source/' ~
'F/Flask/Flask-' ~ latest_version ~ '.tar.gz' %}
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<style type=text/css> <style type=text/css>
h1 { margin: 0 0 30px 0; background: url({{ url_for('.static', filename='logo.png') }}) no-repeat center; height: 165px; } h1 { margin: 0 0 30px 0; background: url({{ url_for('.static', filename='logo.png') }}) no-repeat center; height: 165px; }
h1 span, p.tagline { display: none; } h1 span, p.tagline { display: none; }
</style> </style>
<link href="{{ tweets.feed_url }}" rel="alternate" title="Flask on Twitter" type="application/atom+xml">
{% endblock %} {% endblock %}
{% block body_title %} {% block body_title %}
{{ super() }} {{ super() }}
@ -17,6 +20,9 @@
And before you ask: It's <a href="{{ url_for('docs.show', page='license') And before you ask: It's <a href="{{ url_for('docs.show', page='license')
}}">BSD licensed</a>! }}">BSD licensed</a>!
</blockquote> </blockquote>
<p class=latestver>
<strong>Latest Version:</strong>
<a href="{{ download_url }}" title="Download tarball">{{ latest_version }}</a>
<h2>Flask is Fun</h2> <h2>Flask is Fun</h2>
<pre><span class=ig>from flask import Flask <pre><span class=ig>from flask import Flask
app = Flask(__name__)</span> app = Flask(__name__)</span>
@ -33,13 +39,13 @@ def hello():
<span class=ig> * Running on http://localhost:5000/</span></pre> <span class=ig> * Running on http://localhost:5000/</span></pre>
<h2>Interested?</h2> <h2>Interested?</h2>
<ul> <ul>
<li><a href="{{ download_url }}">Download latest release</a> ({{ latest_version }})
<li> <li>
<a href="{{ url_for('docs.index') }}">Read the documentation</a> or download as <a href="{{ url_for('docs.index') }}">Read the documentation</a> or download as
<a href="{{ url_for('docs.pdf') }}">PDF</a> and <a href="{{ url_for('docs.pdf') }}">PDF</a> and
<a href="{{ url_for('docs.zip') }}">zipped HTML</a> <a href="{{ url_for('docs.zip') }}">zipped HTML</a>
<li><a href="{{ url_for('mailinglist.index') }}">Join the mailinglist</a> <li><a href="{{ url_for('mailinglist.index') }}">Join the mailinglist</a>
<li><a href=http://github.com/mitsuhiko/flask>Fork it on github</a> <li><a href=http://github.com/mitsuhiko/flask>Fork it on github</a>
<li><a href=http://pypi.python.org/pypi/Flask>Download it from PyPI</a>
</ul> </ul>
<h2>Whats in the Box?</h2> <h2>Whats in the Box?</h2>
<ul> <ul>
@ -54,6 +60,7 @@ def hello():
}}#sessions">secure cookies</a> (client side sessions) }}#sessions">secure cookies</a> (client side sessions)
<li>100% <a href=http://www.python.org/dev/peps/pep-0333/>WSGI 1.0</a> compliant <li>100% <a href=http://www.python.org/dev/peps/pep-0333/>WSGI 1.0</a> compliant
<li>Unicode based <li>Unicode based
<li>extensively <a href="{{ url_for('docs.index') }}">documented</a>
</ul> </ul>
<h2>What do Flask Apps look like?</h2> <h2>What do Flask Apps look like?</h2>
<p> <p>
@ -71,22 +78,15 @@ def hello():
<p>Found a bug? Have a good idea for improving Flask? Head over to <p>Found a bug? Have a good idea for improving Flask? Head over to
<a href=http://github.com/mitsuhiko/flask>Flask's github</a> page and <a href=http://github.com/mitsuhiko/flask>Flask's github</a> page and
create a new ticket or fork. If you just want to chat with fellow create a new ticket or fork. If you just want to chat with fellow
developers, go to <code>#pocoo</code> on irc.freenode.net. developers, visit <a href="{{ url_for('community.irc') }}">the IRC
channel</a> or join <a href="{{ url_for('mailinglist.index') }}"
>the mailinglist</a>.
{% if tweets %} {% if tweets %}
<h2>Recent Tweets</h2> <h2>Recent Tweets</h2>
<div class=twitter> <p>
<p> What people say about Flask on <a href=http://twitter.com/>Twitter</a>:
What people say about Flask on <a href=http://twitter.com/>Twitter</a>: {{ tweet_box(tweets, 3) }}
<ul> <p class=more><a href="{{ url_for('community.twitter') }}">more &raquo;<a>
{%- for tweet in tweets %}
<li>
<a href="http://twitter.com/{{ tweet.user }}">{{ tweet.user }}</a>:
{{ tweet.text|urlize }}
<span class=meta>&mdash; {{ tweet.pub_date|timedeltaformat }} ago via {{ tweet.via }}</span>
{%- endfor %}
</ul>
</div>
{% endif %} {% endif %}
<a href="http://github.com/mitsuhiko/flask"><img style="position: fixed; top: 0; right: 0; border: 0;" <a href="http://github.com/mitsuhiko/flask"><img style="position: fixed; top: 0; right: 0; border: 0;"

View file

@ -13,7 +13,7 @@
<p class=nav> <p class=nav>
<a href="{{ url_for('general.index') }}">overview</a> // <a href="{{ url_for('general.index') }}">overview</a> //
<a href="{{ url_for('docs.index') }}">documentation</a> // <a href="{{ url_for('docs.index') }}">documentation</a> //
<a href="{{ url_for('mailinglist.index') }}">mailinglist</a> // <a href="{{ url_for('community.index') }}">community</a> //
<a href="{{ url_for('snippets.index') }}">snippets</a> // <a href="{{ url_for('snippets.index') }}">snippets</a> //
<a href="{{ url_for('extensions.index') }}">extensions</a> <a href="{{ url_for('extensions.index') }}">extensions</a>
{% for message in get_flashed_messages() %} {% for message in get_flashed_messages() %}

View file

@ -1,6 +1,8 @@
{% extends "mailinglist/layout.html" %} {% extends "mailinglist/layout.html" %}
{% block title %}Mailinglist Archive{% endblock %} {% block title %}Mailinglist Archive{% endblock %}
{% block body %} {% block body %}
<p class=backnav>
<a href="{{ url_for('index') }}">&laquo; list information</a>
<h2>Mailinglist Archive</h2> <h2>Mailinglist Archive</h2>
<ul class=archive> <ul class=archive>
{% for thread in threads %} {% for thread in threads %}

View file

@ -1,6 +1,7 @@
{% extends "mailinglist/layout.html" %} {% extends "mailinglist/layout.html" %}
{% block title %}Mailinglist{% endblock %} {% block title %}Mailinglist{% endblock %}
{% block body %} {% block body %}
<h2>Mailinglist Information</h2>
<p> <p>
There is a mailinglist for Flask hosted on <a There is a mailinglist for Flask hosted on <a
href=http://librelist.com/>librelist</a> you can use for both user requests href=http://librelist.com/>librelist</a> you can use for both user requests

View file

@ -2,11 +2,12 @@
{% block title %}{{ thread.title }}{% endblock %} {% block title %}{{ thread.title }}{% endblock %}
{% block head %} {% block head %}
{{ super() }} {{ super() }}
<script type=text/javascript src=/static/mailinglist.js></script> <script type=text/javascript src="{{ url_for('.static',
filename='mailinglist.js') }}"></script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<p class=backnav> <p class=backnav>
<a href=/mailinglist/archive/>&laquo; back to archive</a> <a href="{{ url_for('archive') }}">&laquo; back to archive</a>
<h2>{{ thread.title }}</h2> <h2>{{ thread.title }}</h2>
<ul class=mailtree> <ul class=mailtree>

View file

@ -21,10 +21,9 @@ class SearchResult(object):
class SearchQuery(object): class SearchQuery(object):
fetch_timeout = 10 fetch_timeout = 10
def __init__(self, required=None, optional=None, limit=5, timeout=60, lang=None): def __init__(self, required=None, optional=None, timeout=60, lang=None):
self.required = set(x.lower() for x in (required or ())) self.required = set(x.lower() for x in (required or ()))
self.optional = set(x.lower() for x in (optional or ())) self.optional = set(x.lower() for x in (optional or ()))
self.limit = limit
self.lang = lang self.lang = lang
self.timeout = timeout self.timeout = timeout
self._last_fetch = 0 self._last_fetch = 0
@ -49,6 +48,7 @@ class SearchQuery(object):
return 'http://search.twitter.com/search.%s?%s' % (kind, url_encode({ return 'http://search.twitter.com/search.%s?%s' % (kind, url_encode({
'q': self.query, 'q': self.query,
'result_type': 'mixed', 'result_type': 'mixed',
'rpp': 30,
'lang': self.lang 'lang': self.lang
})) }))
@ -86,6 +86,19 @@ class SearchQuery(object):
return len(self._cached or ()) return len(self._cached or ())
def __iter__(self): def __iter__(self):
return iter(self.get())
def get(self, limit=None):
self._try_refresh() self._try_refresh()
for item in (self._cached or ())[:self.limit]: seq = (self._cached or ())
yield item if limit is not None:
seq = seq[:limit]
return seq
flask_tweets = SearchQuery(
required=['flask'],
optional=['code', 'dev', 'python', 'py', 'pocoo', 'micro',
'mitsuhiko', 'framework', 'django', 'jinja', 'werkzeug',
'documentation', 'app']
)

View file

@ -0,0 +1,28 @@
from flask import Module, render_template
from flask_website.twitter import flask_tweets
community = Module(__name__, url_prefix='/community')
@community.route('/')
def index():
return render_template('community/index.html')
@community.route('/irc/')
def irc():
return render_template('community/irc.html')
@community.route('/twitter/')
def twitter():
return render_template('community/twitter.html', tweets=flask_tweets)
@community.route('/badges/')
def badges():
return render_template('community/badges.html')
@community.route('/logos/')
def logos():
return render_template('community/logos.html')

View file

@ -1,22 +1,17 @@
from flask import Module, render_template, session, redirect, url_for, \ from flask import Module, render_template, session, redirect, url_for, \
request, flash, g, Response request, flash, g, Response
from flaskext.openid import COMMON_PROVIDERS from flaskext.openid import COMMON_PROVIDERS
from flask_website import oid, twitter from flask_website import oid
from flask_website.twitter import flask_tweets
from flask_website.utils import requires_login from flask_website.utils import requires_login
from flask_website.database import db_session, User from flask_website.database import db_session, User
general = Module(__name__) general = Module(__name__)
tweets = twitter.SearchQuery(required=['flask'],
optional=['code', 'web', 'python', 'py',
'pocoo', 'micro', 'mitsuhiko',
'framework', 'django', 'jinja',
'werkzeug', 'documentation',
'app'])
@general.route('/') @general.route('/')
def index(): def index():
return render_template('general/index.html', tweets=tweets) return render_template('general/index.html', tweets=flask_tweets)
@general.route('/logout/') @general.route('/logout/')