git.fiddlerwoaroof.com
Browse code

Various marrow-related changes

- Allow cookies to propagate to subdomains

- restructure config

- update requirements to latest versions

fiddlerwoaroof authored on 02/12/2015 23:26:17
Showing 3 changed files
... ...
@@ -1,13 +1,13 @@
1 1
 Flask==0.10.1
2
-Flask-Cors==2.1.0
3
-Flask-Limiter==0.8.5
2
+Flask-Cors==2.1.2
3
+Flask-Limiter==0.9.1
4 4
 Flask-Login==0.3.2
5 5
 Flask-OAuth==0.12
6
-Flask-Security==1.7.4
6
+Flask-Security==1.7.5
7 7
 Flask-WTF==0.12
8
-lxml==3.4.4
8
+lxml==3.5.0
9 9
 psycopg2==2.6.1
10 10
 python-dateutil==2.4.2
11 11
 requests==2.8.1
12
-textblob==0.10.0
12
+textblob==0.11.0
13 13
 uWSGI==2.0.11.2
... ...
@@ -19,9 +19,11 @@ except ImportError:
19 19
         secret_key = base64.b64encode(os.urandom(24))
20 20
         debug = False
21 21
         static_root =  os.path.join(os.path.dirname(__file__), os.path.pardir, 'static')
22
+        server_name = "localhost"
22 23
 
23 24
 app.secret_key = config.secret_key
24 25
 app.debug = config.debug
26
+app.config["SERVER_NAME"] = config.server_name
25 27
 
26 28
 limiter = Limiter(app)
27 29
 limiter.limit("60/hour 3/second", key_func=lambda: request.host)(user.user_blueprint)
... ...
@@ -1,21 +1,24 @@
1 1
 from flask import g
2 2
 import psycopg2
3
+
3 4
 try: from marrow_config import config
4 5
 except ImportError:
5 6
     class config:
6
-        db = "marrow"
7
-        user = "marrow"
8
-        password = "marrowpass"
9
-        host = "pgsqlserver.elangley.org"
7
+        class db:
8
+            db = "marrow"
9
+            user = "marrow"
10
+            password = "marrowpass"
11
+            host = "pgsqlserver.elangley.org"
10 12
 
11 13
 def get_db(close=True):
12 14
     db = getattr(g, '_database', None)
15
+    _config = config.db
13 16
     if db is None:
14 17
         db = g._database = [psycopg2.connect(
15
-          database=config.db,
16
-          user=config.user,
17
-          password=config.password,
18
-          host=config.host
18
+          database=_config.db,
19
+          user=_config.user,
20
+          password=_config.password,
21
+          host=_config.host
19 22
         ),close];
20 23
     return db[0]
21 24