|
1 | | -"""App Engine settings. |
| 1 | +from oauth_dropins.appengine_config import * |
2 | 2 |
|
3 | | -Reads app keys and secrets into constants from these files: |
4 | | -
|
5 | | -disqus_client_id |
6 | | -disqus_client_secret |
7 | | -dropbox_app_key |
8 | | -dropbox_app_secret |
9 | | -facebook_app_id |
10 | | -facebook_app_secret |
11 | | -facebook_app_id_local |
12 | | -facebook_app_secret_local |
13 | | -flickr_app_key |
14 | | -flickr_app_secret |
15 | | -google_client_id |
16 | | -google_client_secret |
17 | | -instagram_client_id |
18 | | -instagram_client_secret |
19 | | -instagram_client_id_local |
20 | | -instagram_client_secret_local |
21 | | -twitter_app_key |
22 | | -twitter_app_secret |
23 | | -tumblr_app_key |
24 | | -tumblr_app_secret |
25 | | -wordpress_client_id |
26 | | -wordpress_client_secret |
27 | | -wordpress_client_id_local |
28 | | -wordpress_client_secret_local |
29 | | -""" |
30 | | - |
31 | | -import os |
32 | | -import sys |
33 | | - |
34 | | -# Load packages in lib/ |
| 3 | +# Load packages from virtualenv |
| 4 | +# https://cloud.google.com/appengine/docs/python/tools/libraries27#vendoring |
35 | 5 | from google.appengine.ext import vendor |
36 | 6 | vendor.add('local') |
37 | 7 |
|
38 | | -from webutil.appengine_config import * |
39 | | - |
40 | | -# default timeout. the G+ and Instagram APIs use httplib2, which honors this. |
41 | | -import socket |
42 | | -socket.setdefaulttimeout(HTTP_TIMEOUT) |
43 | | -# monkey-patch socket.getdefaulttimeout() because it often gets reset, e.g. by |
44 | | -# socket.setblocking() and maybe other operations. |
45 | | -# http://stackoverflow.com/a/8465202/186123 |
46 | | -socket.getdefaulttimeout = lambda: HTTP_TIMEOUT |
47 | | - |
48 | | -# Add submodule directories to sys.path so they can be imported. |
49 | | -# |
50 | | -# I used to use symlinks and munge sys.modules, but both of those ended up in |
51 | | -# duplicate instances of modules, which caused problems. Background in |
52 | | -# https://github.com/snarfed/bridgy/issues/31 |
53 | | -for path in ( |
54 | | - 'gdata-python-client/src', |
55 | | - ): |
56 | | - path = os.path.join(os.path.dirname(__file__), path) |
57 | | - if path not in sys.path: |
58 | | - sys.path.append(path) |
59 | | - |
60 | | - |
61 | | -def read(filename): |
62 | | - """Returns the contents of filename, or None if it doesn't exist.""" |
63 | | - if os.path.exists(filename): |
64 | | - with open(filename) as f: |
65 | | - return f.read().strip() |
66 | | - |
67 | | -MOCKFACEBOOK = False |
68 | | - |
69 | | -if DEBUG: |
70 | | - FACEBOOK_APP_ID = read('facebook_app_id_local') |
71 | | - FACEBOOK_APP_SECRET = read('facebook_app_secret_local') |
72 | | - INSTAGRAM_CLIENT_ID = read('instagram_client_id_local') |
73 | | - INSTAGRAM_CLIENT_SECRET = read('instagram_client_secret_local') |
74 | | - WORDPRESS_CLIENT_ID = read('wordpress.com_client_id_local') |
75 | | - WORDPRESS_CLIENT_SECRET = read('wordpress.com_client_secret_local') |
76 | | - DISQUS_CLIENT_ID = read('disqus_client_id_local') |
77 | | - DISQUS_CLIENT_SECRET = read('disqus_client_secret_local') |
78 | | -else: |
79 | | - FACEBOOK_APP_ID = read('facebook_app_id') |
80 | | - FACEBOOK_APP_SECRET = read('facebook_app_secret') |
81 | | - INSTAGRAM_CLIENT_ID = read('instagram_client_id') |
82 | | - INSTAGRAM_CLIENT_SECRET = read('instagram_client_secret') |
83 | | - WORDPRESS_CLIENT_ID = read('wordpress.com_client_id') |
84 | | - WORDPRESS_CLIENT_SECRET = read('wordpress.com_client_secret') |
85 | | - DISQUS_CLIENT_ID = read('disqus_client_id') |
86 | | - DISQUS_CLIENT_SECRET = read('disqus_client_secret') |
87 | | - |
88 | | -DROPBOX_APP_KEY = read('dropbox_app_key') |
89 | | -DROPBOX_APP_SECRET = read('dropbox_app_secret') |
90 | | -FLICKR_APP_KEY = read('flickr_app_key') |
91 | | -FLICKR_APP_SECRET = read('flickr_app_secret') |
92 | | -GOOGLE_CLIENT_ID = read('google_client_id') |
93 | | -GOOGLE_CLIENT_SECRET = read('google_client_secret') |
94 | | -TUMBLR_APP_KEY = read('tumblr_app_key') |
95 | | -TUMBLR_APP_SECRET = read('tumblr_app_secret') |
96 | | -TWITTER_APP_KEY = read('twitter_app_key') |
97 | | -TWITTER_APP_SECRET = read('twitter_app_secret') |
0 commit comments