Skip to content

Instantly share code, notes, and snippets.

@proffalken
Created July 8, 2014 07:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proffalken/b8dd8138042026d630bf to your computer and use it in GitHub Desktop.
Save proffalken/b8dd8138042026d630bf to your computer and use it in GitHub Desktop.
pydash
from flask import Flask, render_template
import pygerrit
app = Flask(__name__)
app.config.from_object('config')
@app.errorhandler(404)
def not_found(error):
return render_template('404.html'), 404
from app.gerrit.views import mod as gerritModule
from app.jira.views import mod as jiraModule
app.register_blueprint(gerritModule)
app.register_blueprint(jiraModule)
@app.route("/", methods = ['GET'] )
def index():
gerrit_servers = app.config['GERRIT_SERVERS']
return render_template('index.html', gerrit_servers=gerrit_servers)
<div>
{% block body %}
Sorry, there is nothing here
{% endblock %}
</div>
</div>
#### CONFIG SETTINGS FOR THE DASHBOARD ###
GERRIT_SERVERS = [
{
'name': 'Gerrit One',
'uri': 'https://first.gerrit.server',
'rest_support': False,
'username': 'myuser',
'password': 'password123'
},
{
'name': 'OpenStack',
'uri': 'https://review.openstack.org',
'rest_support': True,
'username': 'myuser',
'password': 'password123'
}
]
JIRA_SERVERS = [
{
'name': 'My JIRA Server',
'uri': 'https://jira.mydomain.com',
'username': 'myuser',
'password': 'password123'
}
]
{% extends "base.html" %}
{% block title %}Dashboard{% endblock %}
<div class="row">
{% for svr in gerrit_servers %}
<div class="col-md-4">
<ul>
<li>{{ svr['name'] }}</li>
</ul>
</div>
{% endfor %}
</div>
{% block body %}
{% endblock %}
@proffalken
Copy link
Author

I've also tried svr.name on line 7 of index.html (the usual style) and that doesn't work either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment