Skip to content

Commit b83f12c

Browse files
author
Coto
committed
config refactoring adding boilerplate.py just for testing purposes
1 parent 7de38e3 commit b83f12c

File tree

7 files changed

+50
-21
lines changed

7 files changed

+50
-21
lines changed

boilerplate/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
'captcha_private_key': "PUT_YOUR_RECAPCHA_PRIVATE_KEY_HERE",
7070

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

7575
# add status codes and templates used to catch and display errors

config/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55

66
import os
77

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

1216
elif os.environ['SERVER_SOFTWARE'].startswith('Google'):
1317
from config.production import config
18+
else:
19+
raise ValueError("Environment undetected")
1420
else:
1521
from config.testing import config

config/boilerplate.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
config = {
2+
3+
# This config file is used only in appengine.beecoss.com (Sample website)
4+
# Don't use values defined here
5+
'environment': "boilerplate",
6+
7+
# contact page email settings
8+
'contact_sender': "appengine@beecoss.com",
9+
'contact_recipient': "appengine@beecoss.com",
10+
11+
'captcha_public_key': "6Lednu0SAAAAAKPyxzxIljKc3po4Fz7lmLsn5s3T",
12+
'captcha_private_key': "6Lednu0SAAAAAGkiiVKmkLvpGT1a-sCkaKf-E4xb",
13+
14+
'send_mail_developer': True,
15+
16+
# fellas' list
17+
'developers': (
18+
('GAE Developer', 'gae-developer2014@beecoss.com'),
19+
),
20+
21+
# It is just an example to fill out this value
22+
'google_analytics_code': """
23+
<script>
24+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
25+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
26+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
27+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
28+
29+
ga('create', 'UA-47489500-1', 'auto', {'allowLinker': true});
30+
ga('require', 'linker');
31+
ga('linker:autoLink', ['beecoss.com', 'blog.beecoss.com', 'appengine.beecoss.com']);
32+
ga('send', 'pageview');
33+
</script>
34+
"""
35+
36+
# ----> ADD MORE CONFIGURATION OPTIONS HERE <----
37+
38+
}

config/localhost.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
11
config = {
22

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

6-
# It is just an example to fill out this value
7-
'google_analytics_code': """
8-
<script>
9-
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
10-
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
11-
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
12-
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
13-
14-
ga('create', 'UA-47489500-1', 'auto', {'allowLinker': true});
15-
ga('require', 'linker');
16-
ga('linker:autoLink', ['beecoss.com', 'blog.beecoss.com', 'appengine.beecoss.com']);
17-
ga('send', 'pageview');
18-
</script>
19-
"""
20-
216
# ----> ADD MORE CONFIGURATION OPTIONS HERE <----
227

238
}

config/production.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
config = {
22

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

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

config/testing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
config = {
22

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

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

locale/es_ES/LC_MESSAGES/messages.po

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ msgstr ""
1010
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
1111
"POT-Creation-Date: 2013-11-13 00:56+0100\n"
1212
"PO-Revision-Date: 2012-06-21 01:50-0400\n"
13-
"Last-Translator: Coto Augosto <coto@beecoss.com>\n"
13+
"Last-Translator: Coto Augosto <@coto>\n"
1414
"Language-Team: es_ES <LL@li.org>\n"
1515
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
1616
"MIME-Version: 1.0\n"

0 commit comments

Comments
 (0)