more refinement
This commit is contained in:
parent
d2f49b258a
commit
115b50bb9b
@ -17,4 +17,4 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
# os.environ['YOURAPPLICATION_CONFIG'] = '/var/www/yourapplication/application.cfg'
|
# 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
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# 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 = Flask(__name__)
|
||||||
|
|
||||||
app.config['MAILGUN_KEY'] = 'key-7o9l9dupikfpsdvqi0ewot-se8g1hz64'
|
app.config['MAILGUN_KEY'] = '#@#@#@#@'
|
||||||
app.config['MAILGUN_DOMAIN'] = 'hastwoparents.com'
|
app.config['MAILGUN_DOMAIN'] = 'refstack.org'
|
||||||
|
app.config['SECRET_KEY'] = '#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@#@'
|
||||||
|
|
||||||
app.config['SECRET_KEY'] = 'GIANT_UGLY-SECRET-GOES-H3r3'
|
|
||||||
db_path = os.path.abspath(
|
|
||||||
os.path.join(os.path.basename(__file__), "../"))
|
|
||||||
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get(
|
app.config['SQLALCHEMY_DATABASE_URI'] = os.environ.get(
|
||||||
'DATABASE_URL', 'sqlite:///%s/refstack.db' % (db_path))
|
'DATABASE_URL', 'sqlite:///%s/refstack.db' % (db_path))
|
||||||
app.config['DEBUG'] = True
|
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_POST_LOGIN_VIEW'] = 'dashboard'
|
||||||
app.config['SECURITY_RECOVERABLE'] = True
|
app.config['SECURITY_RECOVERABLE'] = True
|
||||||
app.config['SECURITY_REGISTERABLE'] = True
|
app.config['SECURITY_REGISTERABLE'] = True
|
||||||
app.config['SECURITY_EMAIL_SENDER'] = "admin@hastwoparents.com"
|
app.config['SECURITY_EMAIL_SENDER'] = "refstack.org"
|
||||||
app.config['MAIL_SERVER'] = 'smtp.mailgun.org'
|
app.config['MAIL_SERVER'] = 'smtp.refstack.org'
|
||||||
app.config['MAIL_PORT'] = 465
|
app.config['MAIL_PORT'] = 465
|
||||||
app.config['MAIL_USE_SSL'] = True
|
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'
|
app.config['MAIL_PASSWORD'] = '1234'
|
||||||
|
@ -16,6 +16,9 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
from flask.ext.sqlalchemy import SQLAlchemy
|
from flask.ext.sqlalchemy import SQLAlchemy
|
||||||
from sqlalchemy.exc import IntegrityError
|
from sqlalchemy.exc import IntegrityError
|
||||||
|
from app import app
|
||||||
|
|
||||||
|
db = SQLAlchemy(app)
|
||||||
|
|
||||||
|
|
||||||
class Vendor(db.Model):
|
class Vendor(db.Model):
|
||||||
|
@ -14,7 +14,9 @@
|
|||||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
import os
|
||||||
from web import app
|
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
|
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
"""
|
|
||||||
Simple Refstack website.
|
|
||||||
"""
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import requests
|
||||||
from flask import Flask, abort, flash, request, redirect, url_for, \
|
from flask import Flask, abort, flash, request, redirect, url_for, \
|
||||||
render_template, g, session
|
render_template, g, session
|
||||||
from flask_openid import OpenID
|
from flask_openid import OpenID
|
||||||
@ -29,19 +26,21 @@ from flask.ext.security import Security, SQLAlchemyUserDatastore, \
|
|||||||
from wtforms import Form, BooleanField, TextField, \
|
from wtforms import Form, BooleanField, TextField, \
|
||||||
PasswordField, validators
|
PasswordField, validators
|
||||||
from flask_mail import Mail
|
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)
|
mail = Mail(app)
|
||||||
|
|
||||||
# setup flask-openid
|
# setup flask-openid
|
||||||
oid = OpenID(app)
|
oid = OpenID(app)
|
||||||
db = SQLAlchemy(app)
|
|
||||||
admin = Admin(app)
|
admin = Admin(app)
|
||||||
|
|
||||||
|
|
||||||
class SecureView(ModelView):
|
class SecureView(ModelView):
|
||||||
|
""" """
|
||||||
def is_accessible(self):
|
def is_accessible(self):
|
||||||
|
""" """
|
||||||
return g.user is not None
|
return g.user is not None
|
||||||
|
|
||||||
admin.add_view(SecureView(Vendor, db.session))
|
admin.add_view(SecureView(Vendor, db.session))
|
||||||
@ -150,13 +149,10 @@ def edit_profile():
|
|||||||
|
|
||||||
@app.route('/logout')
|
@app.route('/logout')
|
||||||
def logout():
|
def logout():
|
||||||
""""""
|
"""logout route"""
|
||||||
session.pop('openid', None)
|
session.pop('openid', None)
|
||||||
flash(u'You have been signed out')
|
flash(u'You have been signed out')
|
||||||
return redirect(oid.get_next_url())
|
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