Skip to content

Commit

Permalink
config refactoring adding boilerplate.py just for testing purposes
Browse files Browse the repository at this point in the history
  • Loading branch information
Coto committed Jan 27, 2014
1 parent 7de38e3 commit b83f12c
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 21 deletions.
2 changes: 1 addition & 1 deletion boilerplate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
'captcha_private_key': "PUT_YOUR_RECAPCHA_PRIVATE_KEY_HERE",

# Use a complete Google Analytics code, no just the Tracking ID
# In config/localhost.py there is an example to fill out this value
# In config/boilerplate.py there is an example to fill out this value
'google_analytics_code': "",

# add status codes and templates used to catch and display errors
Expand Down
8 changes: 7 additions & 1 deletion config/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@

import os

if "SERVER_SOFTWARE" in os.environ:
if os.environ['HTTP_HOST'] == "appengine.beecoss.com":
# Load Boilerplate config only in http://appengine.beecoss.com
# this code is here just for testing purposes
from config.boilerplate import config
elif "SERVER_SOFTWARE" in os.environ:
if os.environ['SERVER_SOFTWARE'].startswith('Dev'):
from config.localhost import config

elif os.environ['SERVER_SOFTWARE'].startswith('Google'):
from config.production import config
else:
raise ValueError("Environment undetected")
else:
from config.testing import config
38 changes: 38 additions & 0 deletions config/boilerplate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
config = {

# This config file is used only in appengine.beecoss.com (Sample website)
# Don't use values defined here
'environment': "boilerplate",

# contact page email settings
'contact_sender': "appengine@beecoss.com",
'contact_recipient': "appengine@beecoss.com",

'captcha_public_key': "6Lednu0SAAAAAKPyxzxIljKc3po4Fz7lmLsn5s3T",
'captcha_private_key': "6Lednu0SAAAAAGkiiVKmkLvpGT1a-sCkaKf-E4xb",

'send_mail_developer': True,

# fellas' list
'developers': (
('GAE Developer', 'gae-developer2014@beecoss.com'),
),

# It is just an example to fill out this value
'google_analytics_code': """
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47489500-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['beecoss.com', 'blog.beecoss.com', 'appengine.beecoss.com']);
ga('send', 'pageview');
</script>
"""

# ----> ADD MORE CONFIGURATION OPTIONS HERE <----

}
17 changes: 1 addition & 16 deletions config/localhost.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,8 @@
config = {

# environment this app is running on: localhost, testing, production
# This config file will be detected in localhost environment and values defined here will overwrite those in config.py
'environment': "localhost",

# It is just an example to fill out this value
'google_analytics_code': """
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-47489500-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['beecoss.com', 'blog.beecoss.com', 'appengine.beecoss.com']);
ga('send', 'pageview');
</script>
"""

# ----> ADD MORE CONFIGURATION OPTIONS HERE <----

}
2 changes: 1 addition & 1 deletion config/production.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config = {

# environment this app is running on: localhost, testing, production
# This config file will be detected in production environment and values defined here will overwrite those in config.py
'environment': "production",

# ----> ADD MORE CONFIGURATION OPTIONS HERE <----
Expand Down
2 changes: 1 addition & 1 deletion config/testing.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
config = {

# environment this app is running on: localhost, testing, production
# This config file will be detected in unit testing environment and values defined here will overwrite those in config.py
'environment': "testing",

# ----> ADD MORE CONFIGURATION OPTIONS HERE <----
Expand Down
2 changes: 1 addition & 1 deletion locale/es_ES/LC_MESSAGES/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msgstr ""
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2013-11-13 00:56+0100\n"
"PO-Revision-Date: 2012-06-21 01:50-0400\n"
"Last-Translator: Coto Augosto <coto@beecoss.com>\n"
"Last-Translator: Coto Augosto <@coto>\n"
"Language-Team: es_ES <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
Expand Down

0 comments on commit b83f12c

Please sign in to comment.