Python Server

This enables the server to be switched over to being Python
rather than just doing static files. This allows for:
 * Dynamic API.
 * Faster loads due to supporting compression of Javascript.
 * Javascript/CSS from local webserver rather then remote.
 * XStatic managed Javascript/CSS.
 * Sharing code between the app-catalog and Horizon.

This patch set enables most of the infrastructure to do that
and copies in the initial website. Minimal changes have been
made to the site to make it compatible with the new code.

Further reviews will switch the site to use more of the new
functionality.

Co-Authored-By: Christopher Aedo <doc@aedo.net>

Change-Id: I2fa9686d3e5db4ee43a02aa7d09b998472e02bf6
This commit is contained in:
Kevin Fox 2015-09-25 06:33:27 -07:00 committed by Christopher Aedo
parent f57e9c30e6
commit 6cc4bf752b
14 changed files with 781 additions and 5 deletions

25
manage.py Normal file
View File

@ -0,0 +1,25 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
"openstack_catalog.settings")
from django.core.management import execute_from_command_line
execute_from_command_line(sys.argv)

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from flask import Flask
from flask import Response
api = Flask('api')
api.debug = True
def cors_allow(resp):
h = ['Origin',
'Accept-Encoding',
'Content-Type',
'X-App-Catalog-Versions']
resp.headers['Access-Control-Allow-Origin'] = '*'
resp.headers['Access-Control-Allow-Headers'] = ', '.join(h)
@api.route('/')
def index():
data = "v1\n"
resp = Response(data, status=200, mimetype='plain/text')
cors_allow(resp)
return resp
# Pull in v1 api into the server.
from openstack_catalog.api.v1 import * # noqa

View File

@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from flask import request
from flask import Response
from openstack_catalog.api import api
from openstack_catalog.api import cors_allow
from openstack_catalog import settings
@api.route('/v1')
def v1_index():
data = "assets\nmurano_repo\n"
resp = Response(data, status=200, mimetype='plain/text')
cors_allow(resp)
return resp
@api.route('/v1/assets', methods=['GET', 'OPTIONS'])
def assets_index():
if request.method == 'OPTIONS':
data = ''
else:
f = open(settings.ASSETS_FILE, 'r')
data = f.read()
f.close()
resp = Response(data, status=200, mimetype='application/json')
resp.headers['Access-Control-Max-Age'] = '3600'
resp.headers['Cache-Control'] = 'max-age=3600'
cors_allow(resp)
return resp
@api.route('/v1/murano_repo/<release>/<path:path>')
def murano_repo_index(release, path):
resp = Response('', status=302)
resp.headers['Location'] = \
"http://storage.apps.openstack.org/{}".format(path)
return resp

View File

@ -0,0 +1,90 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
Django settings for openstack_catalog project.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.6/ref/settings/
"""
import os
import os.path
from static_settings import get_staticfiles_dirs
ASSETS_FILE = 'openstack_catalog/web/api/v1/assets'
STATIC_URL = '/static/'
STATIC_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__),
'web',
'static'))
STATICFILES_DIRS = get_staticfiles_dirs(STATIC_URL)
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
SECRET_KEY = 'notused'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = []
PROJECT_PATH = os.path.realpath(os.path.dirname(__file__))
TEMPLATE_DIRS = (
PROJECT_PATH + '/templates/',
)
COMPRESS_ENABLED = False
COMPRESS_CSS_HASHING_METHOD = 'hash'
COMPRESS_PARSER = 'compressor.parser.HtmlParser'
COMPRESS_OFFLINE_CONTEXT = {
'STATIC_URL': STATIC_URL,
}
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder',
)
INSTALLED_APPS = (
'django.contrib.contenttypes',
'django.contrib.staticfiles',
'compressor',
)
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
)
ROOT_URLCONF = 'openstack_catalog.urls'
WSGI_APPLICATION = 'openstack_catalog.wsgi.application'
LANGUAGE_CODE = 'en-us'
TIME_ZONE = 'UTC'
USE_I18N = True
USE_L10N = True
USE_TZ = True
# Override some values from local_settings.py if found
try:
from openstack_catalog.local_settings import * # noqa
except ImportError:
pass
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.6/howto/static-files/

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import xstatic.main
import xstatic.pkg.angular
import xstatic.pkg.magic_search
def get_staticfiles_dirs(webroot='/'):
return [
('lib/angular',
xstatic.main.XStatic(xstatic.pkg.angular,
root_url=webroot).base_dir),
('lib/magic_search',
xstatic.main.XStatic(xstatic.pkg.magic_search,
root_url=webroot).base_dir),
]

View File

@ -0,0 +1,6 @@
{% load compress %}
{% compress js %}
<script src="{{ STATIC_URL }}lib/angular/angular.js" type='text/javascript' charset="utf-8"></script>
<script src="{{ STATIC_URL }}lib/magic_search/magic_search.js" type='text/javascript' charset="utf-8"></script>
{% endcompress %}

View File

@ -0,0 +1,467 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="OpenStack market place" />
<meta name="keywords" content="openstack, glance images, heat templates, murano applications" />
<meta name="author" content="Mirantis on behalf of OpenStack Foundation" />
<title>Community App Catalog</title>
<link href="/static/images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
{% include "_scripts.html" %}
{% verbatim %}
<!-- Bootstrap core CSS -->
<link href="//cdn.jsdelivr.net/bootstrap/3.3.4/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<!-- Custom styles for this template -->
<link href="static/css/theme.css" rel="stylesheet" type="text/css" />
<link href="//cdn.jsdelivr.net/fontawesome/4.3.0/css/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="//fonts.googleapis.com/css?family=Open+Sans:400italic,400,700" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="//code.jquery.com/ui/1.11.4/themes/cupertino/jquery-ui.css" />
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/jquery.datatables/1.10.4/css/jquery.dataTables.min.css" />
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/select2/3.5.2/select2.css" />
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="//oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="//oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body role="document">
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-K2J65K"
height="0" width="0"
style="display:none;visibility:hidden"></iframe></noscript>
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var
f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-K2J65K');</script>
<!-- End Google Tag Manager -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-17511903-16', {'allowAnchor': true});
ga('send', 'pageview', { 'page': location.pathname + location.search + location.hash});
</script>
<!-- Fixed navbar -->
<div class="masthead navbar-fixed-top">
<div class="container">
<a class="navbar-brand" href="https://www.openstack.org" target="_blank"></a>
<h1><a href="#">Community App Catalog <sup><small>[beta]</small></sup></a></h1>
<a href="https://wiki.openstack.org/wiki/App-Catalog#FAQ" target="_blank" class="btn btn-default pull-right">FAQ</a>
</div>
<nav class="navbar navbar-inverse">
<div class="container">
<div class="navbar-collapse collapse">
<ul id="navbar" class="nav navbar-nav">
<li><a href="#murano-apps">Murano packages</a></li>
<li><a href="#heat-templates">Heat Templates</a></li>
<li><a href="#glance-images">Glance Images</a></li>
<li><a href="#addContent">Add New Content</a></li>
</ul>
</div>
</div>
</nav>
</div>
<div class="container" role="main">
<!-- Main jumbotron for a primary marketing message or call to
action -->
<div id="landing-page" class="content" style="display:none">
<h1>The OpenStack Application Catalog will help you make applications available on your cloud. </h1>
<div class="row featured">
<div class="col-md-2 col-sm-6">
<div class="inner title">
<div>Recently Added Apps</div>
<p>(Requires OpenStack)</p>
</div>
</div>
<div class="col-md-2 col-sm-6">
<div class="inner murano">
<a href="#tab=murano-apps&asset=Kubernetes%20Cluster">
<img src="static/images/logo-kubernetes.png">
<p>Kubernetes</p>
</a>
</div>
</div>
<div class="col-md-2 col-sm-6">
<div class="inner glance">
<a href="#tab=glance-images&asset=Chef%20Server">
<img src="static/images/Chef-124x90-logo.png">
<p>Chef</p></a>
</div>
</div>
<div class="col-md-2 col-sm-6">
<div class="inner murano">
<a href="#tab=murano-apps&asset=Oracle Pluggable Database">
<img src="static/images/logo-oracle.png">
<p>Oracle</p></a>
</div>
</div>
<div class="col-md-2 col-sm-6">
<div class="inner glance">
<a href="#tab=glance-images&asset=Debian%20Jessie%208.0.0%20x64">
<img src="static/images/logo-debian.png">
<p>Debian</p></a>
</div>
</div>
<div class="col-md-2 col-sm-6">
<div class="inner heat">
<a href="#tab=heat-templates&asset=OpenShift%20Origin%203">
<img src="static/images/logo-openshift.png">
<p>OpenShift</p></a>
</div>
</div>
</div>
<div class="row pluginbox">
<div class="col-sm-2">
<a href="https://github.com/openstack/app-catalog-ui" target="_blank">
<img src="static/images/plugin-icon.png">
<div class='lbl'>Horizon Plugin</div>
</a>
</div><div class="col-sm-10">
<p><strong>Want this catalog included in your OpenStack environment?</strong></p>
<p>There is a Horizon plugin available at <a href="https://github.com/openstack/app-catalog-ui" target="_blank">https://github.com/openstack/app-catalog-ui</a> which gives users the ability to search and retrieve App Catalog contents directly from Horizon &mdash; add it to your environment today!</p>
</div>
</div>
<p><strong>Don't have OpenStack yet?</strong></p>
<p>Visit the <a href="https://www.openstack.org/marketplace/" target="_blank">OpenStack Marketplace</a> and select tools and methods for building your cloud. Then come back to the OpenStack Application Catalog to make your cloud sing with applications.</p>
<div class="row">
<div class="col-md-4 bluebox">
<div class="inner">
<a href="#tab=murano-apps">
<h2>Murano Packages</h2>
<img src="static/images/murano-diagram.png">
</a>
<p>
In Murano Packages you will find complete
applications, in both simple and clustered configurations, ready to deploy
on your cloud. To use them:
</p>
<ol>
<li>Verify that you have <A href="http://murano.readthedocs.org/en/latest/" target="_blank">Murano</a> installed</li>
<li>Browse the list and find the app package you want</li>
<li>Highlight and copy the name of the app package</li>
<li>In Horizon, navigate to Murano &gt; Manage &gt; Package Definitions and click Import Package</li>
<li>Paste the app package name into the labeled text field, and click Next. This will download and install the package components.</li>
<li>Now deploy the app on your cloud by navigating to Application Catalog &gt; Environments, then creating and deploying that environment.</li>
</ol>
</div>
</div>
<div class="col-md-4 bluebox">
<div class="inner">
<a href="#tab=heat-templates">
<h2>Heat Templates</h2>
<img src="static/images/heat-diagram.png"
class="text-center">
</a>
<p>
In Heat Templates you will find templates for creating
complete stacks in your cloud. To use them:
</p>
<ol>
<li>Browse the list and find the one you want</li>
<li>Download the template yaml (.yml) file to your local machine</li>
<li>Use Horizon to add the template to Heat (by uploading it via file selector, or copy/pasting it into the editable field)</li>
<li>Use the <a href="http://docs.openstack.org/cli-reference/content/heatclient_commands.html" target="_blank">Heat client</a> to create a stack</li>
</ol>
</div>
</div>
<div class="col-md-4 bluebox">
<div class="inner">
<a href="#tab=glance-images">
<h2>Glance Images</h2>
<img src="static/images/glance-diagram.png">
</a>
<br/><br/>
<p>
In Glance Images you will find a library of
preconfigured images ready to launch virtual machines
on your cloud. To use them:
</p>
<ol>
<li>Browse the list and find the one you want</li>
<li>Copy the URL for the image file</li>
<li>Use the <a href="http://docs.openstack.org/cli-reference/content/glanceclient_commands.html" target="_blank">Glance client</a> to add it to your cloud with the --copy-from option, or add the image from Horizon by creating a new image, and specifying the URL as the image location.</li>
<li>You can use Nova to launch a VM from the new image; or, you can choose an image to launch from the Glance images list shown in Horizon. Of course, if a service is preconfigured to launch VMs by itself directly from specific guest images, you're good to go.
</li>
</ol>
</div>
</div>
</div>
<div class="row">
<p><strong>Contributing to the OpenStack Application Catalog</strong></p>
<p>
The application catalog is built from the YAML files found in the
<a href="https://github.com/openstack/app-catalog" target="_blank">repository</a>.
Consistent with other OpenStack projects, additions to the
catalog take the form of git commits which are reviewed with Gerrit
prior to being merged. Detailed instructions for adding to
the YAML files can be found on the
<a href="https://wiki.openstack.org/wiki/App-Catalog" target="_blank">
OpenStack wiki</a>.
</p>
<p><strong>Catalogue Disclaimer</strong></p>
<p>Please keep in mind that this catalog contains content from many sources,
contributed by the community, for the community. The OpenStack Foundation is not endorsing any particular item listed. Read the <a href="https://wiki.openstack.org/wiki/App-Catalog/Catalogue_Disclaimer" target="_blank">Catalog Disclaimer</a> for additional information.</p>
</div>
</div>
<div id="glance-images" class="content" style="display:none">
<div class="row">
<div class="col-md-6 filters">
&nbsp;
</div>
</div>
<div class="row">
<div class="col-md-12">
<table id="glance-images-table" class="table table-striped">
<thead>
<tr>
<th>Image&nbsp;Name</th>
<th>Description</th>
<th>Format</th>
<th>License</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<div id="heat-templates" class="content" style="display:none">
<div class="row">
<div class="col-md-6 filters">
<form class="form-inline">
<div class="form-group">
<label>Release</label>
<input type="hidden" id="heat-release"
style="width:10em" data-placeholder="Any release"/>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table id="heat-templates-table" class="table table-striped">
<thead>
<tr>
<th>Template&nbsp;Name</th>
<th>Description</th>
<th>Release</th>
<th>Format</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<div id="murano-apps" class="content" style="display:none">
<div class="row">
<div class="col-md-6 filters">
<form class="form-inline">
<div class="form-group">
<label>Release</label>
<input type="hidden" id="murano-release"
style="width:10em" data-placeholder="Any release"/>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table id="murano-apps-table" class="table table-striped">
<thead>
<tr>
<th>Package&nbsp;Name</th>
<th>Description</th>
<th>Release</th>
<th>Format</th>
</tr>
</thead>
</table>
</div>
</div>
</div>
<div id="info-page" class="content">
<div class="row">
<div class="col-md-12">
<div id="info-content"></div>
</div>
</div>
</div>
<div id="info-dialog" title="Details">
<div id="info-container"></div>
</div>
</div>
<!-- core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.datatables/1.10.4/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/select2/3.5.2/select2.min.js"></script>
<script type="text/javascript" src="//ajax.microsoft.com/ajax/jquery.templates/beta1/jquery.tmpl.min.js"></script>
<script type="text/javascript" src="//cdn.jsdelivr.net/jquery.timeago/1.4.1/jquery.timeago.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery.matchHeight/0.6.0/jquery.matchHeight-min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/js-yaml/3.2.7/js-yaml.min.js"></script>
<script type="text/javascript" src="static/js/apps-catalog.js"></script>
<script type="text/javascript">
$(function() { initMarketPlace (); });
$(document).ready(function () { ; } );
</script>
<script id="glance-images-info" type="text/x-jquery-tmpl">
<h2>${name} (${service['disk_format']})</h2>
<div>
{{if attributes['url']}}
<span class="label">glance image-create:</span>
<input type="text" value="glance image-create --copy-from ${attributes['url']} --disk-format ${service['disk_format']} --container-format ${service['container_format']} --name '${name}'" onfocus="this.select();" onmouseup="return false;">
{{else}}
<span class="label">Website where the image can be downloaded:</span>
<a href="${attributes['indirect_url']}">Link...</a>
{{/if}}
</div>
{{if supported_by}}
<div><span class="label">Supported by</span> <span class="value">${supported_by.name}</span></div>
{{/if}}
{{if license}}
{{if license_url}}
<div><span class="label">License</span> <a href="${license_url}"> <span class="value">${license}</span></a></div>
{{else}}
<div><span class="label">License</span> <span class="value">${license}</span></div>
{{/if}}
{{/if}}
<div><span class="label">Description:</span> <span class="value">${description}</span></div>
<h3>Author</h3>
<div><span class="label">Contact:
</span><a href="${provided_by.href}"> <span class="value">${provided_by.name}</span> </a></div>
<div><span class="label">Company:</span> <span class="value">${provided_by.company}</span></div>
{{if attributes }}
<h3>Attributes</h3>
{{each( key, value ) attributes }}
<div><span class="label">${key}:</span> <span class="value">${value}</span></div>
{{/each}}
{{/if}}
</script>
<script id="heat-templates-info" type="text/x-jquery-tmpl">
<h2>${name} (${service['format']})</h2>
{{if supported_by}}
<div><span class="label">Supported by</span> <span class="value">${supported_by.name}</span></div>
{{/if}}
<div><span class="label">Description:</span> <span class="value">${description}</span></div>
<div><span class="label">Available in Releases:</span> <span class="value">${release_html}</span></div>
<h3>Author</h3>
<div><span class="label">Contact:
</span><a href="${provided_by.href}"> <span class="value">${provided_by.name}</span> </a></div>
<div><span class="label">Company:</span> <span class="value">${provided_by.company}</span></div>
{{if attributes }}
<h3>Attributes</h3>
{{each( key, value ) attributes }}
<div><span class="label">${key}:</span> <span class="value">${value}</span></div>
{{/each}}
{{/if}}
</script>
<script id="murano-apps-info" type="text/x-jquery-tmpl">
<h2>${name} ({{if service.type == "bundle"}}bundle{{else}}${service.format}{{/if}})</h2>
<div>
<span class="label">{{if service.format == 'package'}}Package{{else}}Bundle{{/if}} name:</span>
{{if service.type == 'bundle'}}
<input type="text" value="${service.murano_package_name}" onfocus="this.select();" onmouseup="return false;">
{{else}}
<input type="text" value="${service.package_name}" onfocus="this.select();" onmouseup="return false;">
{{/if}}
</div>
<h3>Description</h3>
<div><span class="value">${description}</span></div>
<h3>Supported OpenStack Releases</h3>
<div><span class="value">${release_html}</span></div>
<h3>Author</h3>
<div><span class="label">Contact: </span><a href="${provided_by.href}"> <span class="value">${provided_by.name}</span> </a></div>
<div><span class="label">Company:</span> <span class="value">${provided_by.company}</span></div>
{{if depends }}
<h3>Depends On</h3>
<p>Package may depend on image and on other packages, during import of
this package to Murano following dependencies will be also downloaded
and imported, but existing entries will not be overwritten.</p>
{{if depends }}
Dependencies:
<ul>
{{each depends }}
<li>${depends[$index]['name']}</li>
{{/each}}
</ul>
{{/if}}
{{/if}}
{{if attributes }}
<h3>Attributes</h3>
{{each( key, value ) attributes }}
<div><span class="label">${key}:</span> <span class="value">${value}</span></div>
{{/each}}
{{/if}}
</script>
</body>
</html>
{% endverbatim %}

View File

@ -0,0 +1,9 @@
from django.conf.urls import patterns
from django.conf.urls import url
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
from openstack_catalog import views
urlpatterns = patterns('', url(r'^$', views.index))
urlpatterns += staticfiles_urlpatterns()

View File

@ -0,0 +1,5 @@
from django.shortcuts import render
def index(request):
return render(request, 'index.html', {})

View File

@ -0,0 +1,7 @@
from openstack_catalog import wsgi_django
from openstack_catalog.api import api
from werkzeug.wsgi import DispatcherMiddleware
application = DispatcherMiddleware(wsgi_django.application, {'/api': api})

View File

@ -0,0 +1,28 @@
# -*- coding: utf-8 -*-
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
WSGI config for openstack_catalog project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "openstack_catalog.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

View File

@ -2,5 +2,12 @@
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
pbr>=0.6,!=0.7,<1.0
pbr>=1.3
Babel>=1.3
Django<1.9,>=1.7
django-compressor>=1.4
XStatic>=1.0.0 # MIT License
XStatic-Angular>=1.3.7 # MIT License
XStatic-Magic-Search>=0.2.5.1 # Apache 2.0 License
werkzeug
flask

View File

@ -43,14 +43,27 @@ done
function run_server {
echo "Starting development server..."
$root/tools/update_assets.sh
pushd $root/openstack_catalog/web > /dev/null
${command_wrapper} python $root/tools/testserver.py runserver $testopts $testargs
popd > /dev/null
if [ ! -d $venv ]; then
virtualenv $venv
. $venv/bin/activate
fi
. $venv/bin/activate
pip install -r $root/requirements.txt
#FIXME make venv cleaner.
# FIXME remove when CORS works
# pushd $root/openstack_catalog/web > /dev/null
# ${command_wrapper} python $root/tools/testserver.py runserver $testopts $testargs
${command_wrapper} python manage.py runserver $testopts $testargs
# popd > /dev/null
echo "Server stopped."
}
# Development server
if [ $runserver -eq 1 ]; then
if [ "x$testargs" = "x" -o "$testargs x" = " x" ]; then
testargs="127.0.0.1:18001"
fi
run_server
exit $?
fi

View File

@ -1,5 +1,5 @@
[metadata]
name = catalog
name = openstack_catalog
summary = Application catalog for OpenStack
description-file =
README.rst