add psycopg2 connect
This commit is contained in:
commit
c1991f5241
5 changed files with 7 additions and 6 deletions
3
app.py
3
app.py
|
@ -18,7 +18,7 @@ app.config.from_object(os.getenv('CONFIGURATION_OBJECT'))
|
||||||
# ! Environment Variable
|
# ! Environment Variable
|
||||||
# TODO export ALLOWED_ORIGIN= whatever the react server is
|
# TODO export ALLOWED_ORIGIN= whatever the react server is
|
||||||
# TODO cors_allowed_origins=os.getenv('ALLOWED_ORIGIN')
|
# 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():
|
def create_app():
|
||||||
CORS(app, resources={
|
CORS(app, resources={
|
||||||
|
@ -28,3 +28,4 @@ def create_app():
|
||||||
db.init_app(app)
|
db.init_app(app)
|
||||||
ma.init_app(app)
|
ma.init_app(app)
|
||||||
return app
|
return app
|
||||||
|
|
|
@ -29,6 +29,6 @@ class TestingConfig(BaseConfig):
|
||||||
|
|
||||||
class ProductionConfig(BaseConfig):
|
class ProductionConfig(BaseConfig):
|
||||||
"""Production configuration."""
|
"""Production configuration."""
|
||||||
SECRET_KEY = ''
|
SECRET_KEY = os.getenv('SECRET_KEY')
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
SQLALCHEMY_DATABASE_URI = 'postgresql:///'
|
SQLALCHEMY_DATABASE_URI = 'postgres://mzwaocmnwvesac:d86d256a9e73639d0ac1eba3651f3f5268540e6417b110265fd58398358d1c1b@ec2-174-129-227-51.compute-1.amazonaws.com:5432/d1jbr1uiojpma'
|
||||||
|
|
|
@ -22,7 +22,7 @@ from models.Move import Move
|
||||||
from models.User import User
|
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
|
@manager.command
|
||||||
def test():
|
def test():
|
||||||
"""Runs the unit tests without test coverage."""
|
"""Runs the unit tests without test coverage."""
|
||||||
|
|
|
@ -26,7 +26,7 @@ app.register_blueprint(server)
|
||||||
migrate = Migrate(app, db)
|
migrate = Migrate(app, db)
|
||||||
# added 10/14
|
# added 10/14
|
||||||
DATABASE_URL = os.environ['DATABASE_URL']
|
DATABASE_URL = os.environ['DATABASE_URL']
|
||||||
# conn = psycopg2.connect(DATABASE_URL, sslmode='require')
|
conn = psycopg2.connect(DATABASE_URL, sslmode='require')
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
socketio.run(app, debug=False)
|
socketio.run(app, debug=False)
|
||||||
|
|
Loading…
Reference in a new issue