Compare commits

...

6 commits

Author SHA1 Message Date
sorrelbri
8fa7cc8a85
Merge pull request #23 from sorrelbri/sj-ready-deploy
Sj ready deploy
2019-10-24 16:13:30 -07:00
Sorrel Bri
586a983d61 ready procfile for deploy 2019-10-24 16:12:09 -07:00
Sorrel Bri
a7c39d9b44 config server.py for deploy 2019-10-24 16:11:27 -07:00
Sorrel Bri
b0e4d2aa99 Merge branch 'dev' of https://github.com/sorrelbri/browser-go-api into dev 2019-10-14 09:11:40 -07:00
sorrelbri
0bca86cf79
Merge pull request #21 from sorrelbri/sj-game-logic
sj game logic
2019-10-13 21:46:30 -07:00
sorrelbri
c14688f1e8
Merge pull request #20 from sorrelbri/dev
test deployment
2019-10-12 10:30:47 -07:00
4 changed files with 28 additions and 10 deletions

View file

@ -1 +1,2 @@
web: gunicorn app:app
web: gunicorn server:app
release: python manage.py db upgrade

View file

@ -8,9 +8,12 @@ def jwt_required():
auth_header = request.headers.get('Authorization') or None
if auth_header:
auth_token = auth_header.split(" ")[1]
if jwt.decode(auth_token, os.environ.get('SECRET_KEY')):
return func(*args, **kwargs)
else:
try:
if jwt.decode(auth_token, os.environ.get('SECRET_KEY')):
return func(*args, **kwargs)
else:
abort(401)
except:
abort(401)
else:
abort(401)

View file

@ -26,7 +26,6 @@ def get_room(game_id):
game.player_black = user['id']
db.session.add(game)
db.session.commit()
print(game.player_black)
join_game_notice(game)
response = {'game': game_schema.dumps(game)}
if game.player_black:

View file

@ -1,17 +1,32 @@
from app import create_app, db
import os
# Blueprints
from api.api import register_api_endpoints
from auth.auth import auth
# Web sockets
from websockets.socket import socketio
from websockets.socket import socketio
import configuration.models_mount
from flask_migrate import Migrate
from flask import Blueprint, jsonify
import psycopg2
server = Blueprint('server', __name__, url_prefix='/')
@server.route('/', methods=['GET'])
def api_home():
response = {"message": "hello world"}
return jsonify(response)
app = create_app()
register_api_endpoints(app)
app.register_blueprint(server)
migrate = Migrate(app, db)
# added 10/14
DATABASE_URL = os.environ['DATABASE_URL']
# conn = psycopg2.connect(DATABASE_URL, sslmode='require')
if __name__ == '__main__':
app = create_app()
register_api_endpoints(app)
migrate = Migrate(app, db)
socketio.run(app, debug=True)
socketio.run(app, debug=True)