diff --git a/.gitignore b/.gitignore index 49e3f875..9f6ff4c3 100755 --- a/.gitignore +++ b/.gitignore @@ -51,4 +51,6 @@ scripts/members_sponsors_20131030.csv refstack/client/.smbdeleteAAA9ef44.4 +openid/* + db.sqlite diff --git a/README.rst b/README.rst index a63cbee7..1d1ef563 100755 --- a/README.rst +++ b/README.rst @@ -13,7 +13,7 @@ Okay, I'm Sold, How Do I Run This Myself? This is our documentation for how we get this set up:: # Git you clonin' - git clone http://github.com/openstack-ops/refstack + git clone http://github.com/stackforge/refstack cd refstack @@ -22,15 +22,15 @@ This is our documentation for how we get this set up:: # `alembic.ini` to get this working # PROTIP: if you just want to test this out, use `-n alembic_sqlite` to # make a local sqlite db - # $ alembic -n alembic_sqlite update head - alembic update head + # $ alembic -n alembic_sqlite upgrade head + alembic upgrade head # Plug this bad boy into your server infrastructure. # We use nginx and gunicorn, you may use something else if you are smarter # than we are. # For the most basic setup that you can try right now, just kick off # gunicorn: - gunicorn refstack.web:app + gunicorn -b 0.0.0.0:8000 refstack.web:app # To actually configure this winner, check out the config section and # crack open refstack.cfg in vim. diff --git a/refstack/extensions.py b/refstack/extensions.py old mode 100644 new mode 100755 index 5d528c23..ccf6bcbe --- a/refstack/extensions.py +++ b/refstack/extensions.py @@ -1,6 +1,18 @@ -# -*- coding: utf-8 -*- - -# This file based on MIT licensed code at: https://github.com/imwilsonxu/fbone +# +# Copyright (c) 2013 Piston Cloud Computing, Inc. +# All Rights Reserved. +# +# 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.ext.admin import Admin admin = Admin() diff --git a/refstack/templates/errors/page_not_found.html b/refstack/templates/errors/page_not_found.html new file mode 100644 index 00000000..32616182 --- /dev/null +++ b/refstack/templates/errors/page_not_found.html @@ -0,0 +1 @@ +page not found diff --git a/refstack/web.py b/refstack/web.py index 2984da41..4f072d41 100755 --- a/refstack/web.py +++ b/refstack/web.py @@ -13,41 +13,27 @@ # License for the specific language governing permissions and limitations # under the License. # -from flask import abort, flash, request, redirect, url_for, \ - render_template, g, session, flask -#from flask_openid import OpenID -#from flask.ext.admin import Admin, BaseView, expose, AdminIndexView -#from flask.ext.admin.contrib.sqlamodel import ModelView -#from flask.ext.security import Security, \ -# UserMixin, login_required -#from wtforms import TextField -from flask_mail import Mail +import flask +from flask import abort, flash, request, redirect, url_for, \ + render_template, g, session +from flask_mail import Mail from refstack import app as base_app from refstack.extensions import db from refstack.extensions import oid -#from refstack import api -#from refstack.models import ApiKey -#from refstack.models import Cloud -#from refstack.models import Test -#from refstack.models import TestResults -#from refstack.models import TestStatus from refstack.models import User from refstack.models import Vendor +from refstack.models import Cloud -# TODO(termie): transition all the routes below to blueprints -# TODO(termie): use extensions setup from the create_app() call - app = base_app.create_app() - mail = Mail(app) @app.before_request def before_request(): """Runs before the request itself.""" - flask.g.user = None + g.user = None if 'openid' in session: flask.g.user = User.query.filter_by(openid=session['openid']).first() @@ -57,7 +43,7 @@ def index(): """Index view.""" if g.user is not None: # something else - clouds = db.Cloud.query.filter_by(user_id=g.user.id).all() + clouds = Cloud.query.filter_by(user_id=g.user.id).all() return render_template('home.html', clouds=clouds) else: vendors = Vendor.query.all() @@ -123,7 +109,7 @@ def create_profile(): @app.route('/delete-cloud/', methods=['GET', 'POST']) def delete_cloud(cloud_id): """Delete function for clouds.""" - c = db.Cloud.query.filter_by(id=cloud_id).first() + c = Cloud.query.filter_by(id=cloud_id).first() if not c: flash(u'Not a valid Cloud ID!') @@ -138,7 +124,7 @@ def delete_cloud(cloud_id): @app.route('/edit-cloud/', methods=['GET', 'POST']) def edit_cloud(cloud_id): - c = db.Cloud.query.filter_by(id=cloud_id).first() + c = Cloud.query.filter_by(id=cloud_id).first() if not c: flash(u'Not a valid Cloud ID!') @@ -209,7 +195,7 @@ def create_cloud(): elif not request.form['admin_key']: flash(u'Error: All fields are required') else: - c = db.Cloud() + c = Cloud() c.user_id = g.user.id c.label = request.form['label'] c.endpoint = request.form['endpoint']