Skip to content

Commit

Permalink
Updated Flask Ports
Browse files Browse the repository at this point in the history
  • Loading branch information
TheManWhoLikesToCode committed Jan 11, 2024
1 parent aa23a7d commit 0080ebb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 11 deletions.
4 changes: 2 additions & 2 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def authorize_drive():
if gauth.access_token_expired:
gauth.Refresh()
gauth.SaveCredentialsFile("credentials.json")

drive = GoogleDrive(gauth)
return drive

Expand Down Expand Up @@ -297,4 +297,4 @@ def list_root_directory():
scheduler.init_app(app)
scheduler.start()

app.run(host='0.0.0.0', debug=app.config['DEBUG'])
app.run(host='0.0.0.0', port=app.config['PORT'], debug=app.config['DEBUG'])
19 changes: 16 additions & 3 deletions backend/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# config.py
from selenium.webdriver.chrome.options import Options

import os
from dotenv import load_dotenv
import sys
# Flask configuration
DEBUG = True # Set to False in production
load_dotenv()

env = os.environ.get('ENVIRONMENT')

if env == 'dev':
PORT = 5003
DEBUG = True
elif env == 'prod':
PORT = 5001
DEBUG = False
else:
print("Environment not specified. Please provide a valid environment.")
sys.exit(1)
2 changes: 1 addition & 1 deletion frontend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ def login():
return jsonify(success=True)

if __name__ == '__main__':
app.run(host='0.0.0.0', debug=app.config['DEBUG'])
app.run(host='0.0.0.0', port=app.config['PORT'], debug=app.config['DEBUG'])
21 changes: 16 additions & 5 deletions frontend/config.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
# config.py
import os
from dotenv import load_dotenv
import sys

# Flask configuration
DEBUG = True # Set to False in production
load_dotenv()

env = os.environ.get('ENVIRONMENT')

if env == 'dev':
PORT = 5004
DEBUG = True
elif env == 'prod':
PORT = 5002
DEBUG = False
else:
print("Environment not specified. Please provide a valid environment.")
sys.exit(1)

# CORS Configurations
CORS_HEADERS = 'Content-Type'

# Security configurations
# It's advisable to use environment variables for sensitive data
# Example: SECRET_KEY = os.environ.get('SECRET_KEY') or 'a-default-secret'

0 comments on commit 0080ebb

Please sign in to comment.