diff --git a/app.py b/app.py index bc61392..cb218c2 100644 --- a/app.py +++ b/app.py @@ -18,7 +18,7 @@ app.config.from_object(os.getenv('CONFIGURATION_OBJECT')) # ! Environment Variable # TODO export ALLOWED_ORIGIN= whatever the react server is # TODO cors_allowed_origins=os.getenv('ALLOWED_ORIGIN') -socketio = SocketIO(app, cors_allowed_origins=['http://localhost:3000', 'http://localhost:3001']) +socketio = SocketIO(app, cors_allowed_origins=os.getenv('ALLOWED_ORIGIN')) def create_app(): CORS(app, resources={ @@ -28,3 +28,4 @@ def create_app(): db.init_app(app) ma.init_app(app) return app + \ No newline at end of file diff --git a/configuration/config.py b/configuration/config.py index efdd88e..d326153 100644 --- a/configuration/config.py +++ b/configuration/config.py @@ -29,6 +29,6 @@ class TestingConfig(BaseConfig): class ProductionConfig(BaseConfig): """Production configuration.""" - SECRET_KEY = '' + SECRET_KEY = os.getenv('SECRET_KEY') DEBUG = False - SQLALCHEMY_DATABASE_URI = 'postgresql:///' + SQLALCHEMY_DATABASE_URI = 'postgres://mzwaocmnwvesac:d86d256a9e73639d0ac1eba3651f3f5268540e6417b110265fd58398358d1c1b@ec2-174-129-227-51.compute-1.amazonaws.com:5432/d1jbr1uiojpma' diff --git a/manage.py b/manage.py index 9d4590a..ab79c03 100644 --- a/manage.py +++ b/manage.py @@ -22,7 +22,7 @@ from models.Move import Move from models.User import User -app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://localhost/browser-go' +app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv('DATABASE_URL') @manager.command def test(): """Runs the unit tests without test coverage.""" diff --git a/models/Game.py b/models/Game.py index 4f0c873..ab74f72 100644 --- a/models/Game.py +++ b/models/Game.py @@ -84,6 +84,6 @@ class GameSchema(ma.Schema): player_black = fields.Int() player_white = fields.Int() - + game_schema = GameSchema() games_schema = GameSchema(many=True) \ No newline at end of file diff --git a/server.py b/server.py index e1a5b2f..a463303 100644 --- a/server.py +++ b/server.py @@ -26,7 +26,7 @@ app.register_blueprint(server) migrate = Migrate(app, db) # added 10/14 DATABASE_URL = os.environ['DATABASE_URL'] -# conn = psycopg2.connect(DATABASE_URL, sslmode='require') +conn = psycopg2.connect(DATABASE_URL, sslmode='require') if __name__ == '__main__': socketio.run(app, debug=False)