Skip to content

Commit

Permalink
fixing settings and env
Browse files Browse the repository at this point in the history
  • Loading branch information
Helen Chen committed Aug 2, 2020
1 parent fcf5339 commit 4c16ba7
Show file tree
Hide file tree
Showing 11 changed files with 40 additions and 208 deletions.
11 changes: 11 additions & 0 deletions .env-example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
REACT_APP_AUTH0_DOMAIN=# your auth0 domain
REACT_APP_AUTH0_CLIENT_ID=# auth0 client id
DATABASE_NAME=
DATABASE_PASSWORD=
DATABASE_USER=
DATABASE_HOST=
SECRET_KEY=
GA_TRACKING_ID=# google analytics


# example .env file, config with your own variable details
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ ENV/
env.bak/
venv.bak/
.DS_Store
settings_local.py


9 changes: 9 additions & 0 deletions bboyproj/development.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from dotenv import load_dotenv
load_dotenv()
from .settings import *


DEBUG = True


SECURE_SSL_REDIRECT = False
8 changes: 8 additions & 0 deletions bboyproj/production.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from .settings import *


DEBUG = False



SECURE_SSL_REDIRECT = True
4 changes: 2 additions & 2 deletions bboyproj/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
SECRET_KEY = os.getenv('SECRET_KEY')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
# DEBUG = True

ALLOWED_HOSTS = ['bboygen.herokuapp.com', 'localhost', '*']

Expand Down Expand Up @@ -175,7 +175,7 @@

CORS_ORIGIN_ALLOW_ALL = True
# redirects from http -> https
SECURE_SSL_REDIRECT = True
# SECURE_SSL_REDIRECT = False

#ACCOUNT_EMAIL_VERIFICATION = 'none'
#ACCOUNT_EMAIL_REQUIRED = False
Expand Down
185 changes: 0 additions & 185 deletions bboyproj/settings_local.py

This file was deleted.

2 changes: 1 addition & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@


def main():
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bboyproj.settings')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'bboyproj.production')
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
Expand Down
4 changes: 3 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,17 @@ asgiref==3.2.7
certifi==2020.4.5.1
chardet==3.0.4
defusedxml==0.6.0
Django==3.0.7
Django==3.0.8
django-allauth==0.42.0
django-cors-headers==3.3.0
django-environ==0.4.5
django-rest-auth==0.9.5
djangorestframework==3.11.0
gunicorn==20.0.4
idna==2.9
oauthlib==3.1.0
psycopg2-binary==2.8.5
python-dotenv==0.14.0
python3-openid==3.1.0
pytz==2020.1
requests==2.23.0
Expand Down
1 change: 0 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import "./css/App.css"
import { useAuth0 } from "@auth0/auth0-react";
import history from "./utils/history";

import ReactGA from 'react-ga';
// grabs the store we created and allow us to access states
// import * as actions from './store/actions/auth';
// import { connect } from 'react-redux';
Expand Down
4 changes: 0 additions & 4 deletions src/auth_config.json

This file was deleted.

18 changes: 5 additions & 13 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,12 @@ import * as serviceWorker from './serviceWorker';

import { Auth0Provider } from "@auth0/auth0-react";
import history from "./utils/history";
import config from "./auth_config.json";


import { createStore, compose, applyMiddleware } from 'redux';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import reducer from './store/reducers/auth';

import ReactGA from 'react-ga';

// checking if we have this extension installed, else uses redux compose
const composeEnhances = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose
const store = createStore(reducer, composeEnhances(
applyMiddleware(thunk)
));

const onRedirectCallback = (appState) => {
history.push(
Expand All @@ -28,15 +21,14 @@ const onRedirectCallback = (appState) => {
};

// start google analytics
const trackingId = "UA-174149310-1"; // Replace with your Google Analytics tracking ID
const trackingId = process.env.GA_TRACKING_ID; // Replace with your Google Analytics tracking ID
ReactGA.initialize(trackingId);

// bring in provider
const app = (
<Auth0Provider
domain={config.domain}
clientId={config.clientId}
audience={config.audience}
domain={process.env.REACT_APP_AUTH0_DOMAIN}
clientId={process.env.REACT_APP_AUTH0_CLIENT_ID}
redirectUri={window.location.origin}
onRedirectCallback={onRedirectCallback}
useRefreshTokens={true}
Expand Down

0 comments on commit 4c16ba7

Please sign in to comment.