more refinement
This commit is contained in:
parent
d2f49b258a
commit
115b50bb9b
@ -17,30 +17,30 @@ import sqlalchemy as sa
|
||||
def upgrade():
|
||||
### commands auto generated by Alembic - please adjust! ###
|
||||
op.create_table('user',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=60), nullable=True),
|
||||
sa.Column('email', sa.String(length=200), nullable=True),
|
||||
sa.Column('openid', sa.String(length=200), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('openid')
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('name', sa.String(length=60), nullable=True),
|
||||
sa.Column('email', sa.String(length=200), nullable=True),
|
||||
sa.Column('openid', sa.String(length=200), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('openid')
|
||||
)
|
||||
op.create_table('cloud',
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('vendor_id', sa.Integer(), nullable=True),
|
||||
sa.Column('endpoint', sa.String(length=120), nullable=True),
|
||||
sa.Column('test_user', sa.String(length=80), nullable=True),
|
||||
sa.Column('test_key', sa.String(length=80), nullable=True),
|
||||
sa.Column('admin_endpoint', sa.String(length=120), nullable=True),
|
||||
sa.Column('admin_user', sa.String(length=80), nullable=True),
|
||||
sa.Column('admin_key', sa.String(length=80), nullable=True),
|
||||
sa.ForeignKeyConstraint(['vendor_id'], ['vendor.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('admin_endpoint'),
|
||||
sa.UniqueConstraint('admin_key'),
|
||||
sa.UniqueConstraint('admin_user'),
|
||||
sa.UniqueConstraint('endpoint'),
|
||||
sa.UniqueConstraint('test_key'),
|
||||
sa.UniqueConstraint('test_user')
|
||||
sa.Column('id', sa.Integer(), nullable=False),
|
||||
sa.Column('vendor_id', sa.Integer(), nullable=True),
|
||||
sa.Column('endpoint', sa.String(length=120), nullable=True),
|
||||
sa.Column('test_user', sa.String(length=80), nullable=True),
|
||||
sa.Column('test_key', sa.String(length=80), nullable=True),
|
||||
sa.Column('admin_endpoint', sa.String(length=120), nullable=True),
|
||||
sa.Column('admin_user', sa.String(length=80), nullable=True),
|
||||
sa.Column('admin_key', sa.String(length=80), nullable=True),
|
||||
sa.ForeignKeyConstraint(['vendor_id'], ['vendor.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('admin_endpoint'),
|
||||
sa.UniqueConstraint('admin_key'),
|
||||
sa.UniqueConstraint('admin_user'),
|
||||
sa.UniqueConstraint('endpoint'),
|
||||
sa.UniqueConstraint('test_key'),
|
||||
sa.UniqueConstraint('test_user')
|
||||
)
|
||||
### end Alembic commands ###
|
||||
|
||||
|
@ -17,4 +17,4 @@
|
||||
|
||||
import os
|
||||
# os.environ['YOURAPPLICATION_CONFIG'] = '/var/www/yourapplication/application.cfg'
|
||||
from refstack import web
|
||||
from refstack.app import app
|
||||
|
@ -14,17 +14,17 @@
|
||||
# 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
|
||||
from flask import Flask, session
|
||||
|
||||
db_path = os.path.abspath(
|
||||
os.path.join(os.path.basename(__file__), "../"))
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
app.config['MAILGUN_KEY'] = 'key-7o9l9dupikfpsdvqi0ewot-se8g1hz64'
|
||||
app.config['MAILGUN_DOMAIN'] = 'hastwoparents.com'
|
||||
|
||||
|
||||
app.config['SECRET_KEY'] = 'GIANT_UGLY-SECRET-GOES-H3r3'
|
||||
db_path = os.path.abspath(
|
||||
os.path.join(os.path.basename(__file__), "../"))
|
||||
app.config['MAILGUN_KEY'] = '#@#@#@#@'
|
||||
app.config['MAILGUN_DOMAIN'] = 'refstack.org'
|
||||
app.config['SECRET_KEY'] = '#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@'
|
||||
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get(
|
||||
'DATABASE_URL', 'sqlite:///%s/refstack.db' % (db_path))
|
||||
app.config['DEBUG'] = True
|
||||
@ -33,9 +33,9 @@ app.config['SECURITY_PASSWORD_SALT'] = app.config['SECRET_KEY']
|
||||
app.config['SECURITY_POST_LOGIN_VIEW'] = 'dashboard'
|
||||
app.config['SECURITY_RECOVERABLE'] = True
|
||||
app.config['SECURITY_REGISTERABLE'] = True
|
||||
app.config['SECURITY_EMAIL_SENDER'] = "admin@hastwoparents.com"
|
||||
app.config['MAIL_SERVER'] = 'smtp.mailgun.org'
|
||||
app.config['SECURITY_EMAIL_SENDER'] = "refstack.org"
|
||||
app.config['MAIL_SERVER'] = 'smtp.refstack.org'
|
||||
app.config['MAIL_PORT'] = 465
|
||||
app.config['MAIL_USE_SSL'] = True
|
||||
app.config['MAIL_USERNAME'] = 'postmaster@hastwoparents.com'
|
||||
app.config['MAIL_USERNAME'] = 'postmaster@refstack.org'
|
||||
app.config['MAIL_PASSWORD'] = '1234'
|
||||
|
@ -16,6 +16,9 @@
|
||||
# under the License.
|
||||
from flask.ext.sqlalchemy import SQLAlchemy
|
||||
from sqlalchemy.exc import IntegrityError
|
||||
from app import app
|
||||
|
||||
db = SQLAlchemy(app)
|
||||
|
||||
|
||||
class Vendor(db.Model):
|
||||
|
@ -14,7 +14,9 @@
|
||||
# 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
|
||||
from web import app
|
||||
|
||||
app.run()
|
||||
app.logger.setLevel('DEBUG')
|
||||
port = int(os.environ.get('PORT', 5000))
|
||||
app.run(host='172.16.200.128', port=port, debug=True)
|
@ -14,11 +14,8 @@
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
"""
|
||||
Simple Refstack website.
|
||||
"""
|
||||
|
||||
import os
|
||||
import requests
|
||||
from flask import Flask, abort, flash, request, redirect, url_for, \
|
||||
render_template, g, session
|
||||
from flask_openid import OpenID
|
||||
@ -29,19 +26,21 @@ from flask.ext.security import Security, SQLAlchemyUserDatastore, \
|
||||
from wtforms import Form, BooleanField, TextField, \
|
||||
PasswordField, validators
|
||||
from flask_mail import Mail
|
||||
import requests
|
||||
from app inport app
|
||||
|
||||
from app import app
|
||||
from models import Vendor, Cloud, User, db
|
||||
|
||||
mail = Mail(app)
|
||||
|
||||
# setup flask-openid
|
||||
oid = OpenID(app)
|
||||
db = SQLAlchemy(app)
|
||||
admin = Admin(app)
|
||||
|
||||
|
||||
class SecureView(ModelView):
|
||||
""" """
|
||||
def is_accessible(self):
|
||||
""" """
|
||||
return g.user is not None
|
||||
|
||||
admin.add_view(SecureView(Vendor, db.session))
|
||||
@ -150,13 +149,10 @@ def edit_profile():
|
||||
|
||||
@app.route('/logout')
|
||||
def logout():
|
||||
""""""
|
||||
"""logout route"""
|
||||
session.pop('openid', None)
|
||||
flash(u'You have been signed out')
|
||||
return redirect(oid.get_next_url())
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.logger.setLevel('DEBUG')
|
||||
port = int(os.environ.get('PORT', 5000))
|
||||
app.run(host='0.0.0.0', port=port, debug=True)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user