Skip to content

Commit 2866322

Browse files
author
khz
committed
small change to cinfig.py base_url => protocol + host + port
1 parent ac0e6d7 commit 2866322

File tree

3 files changed

+21
-4
lines changed

3 files changed

+21
-4
lines changed

pythononwheels/start/application.py

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import os
66
import os.path
77
import sys
8+
from werkzeug.routing import Rule, Map, _rule_re
89

910
import {{appname}}.config as cfg
1011
from {{appname}}.powlib import merge_two_dicts
@@ -277,6 +278,21 @@ def decorator(cls):
277278
pattern = r._regex.pattern.replace('^\\|', "")
278279
print("r1: " + str(pattern))
279280
fin_route = pattern
281+
route_tuple = (fin_route,cls, dispatch)
282+
handlers.append((route_tuple,pos))
283+
# now add the route for the optional format parameter
284+
285+
# r=Rule(route+r".<format>", endpoint=cls_name)
286+
# m = Map()
287+
# m.add(r)
288+
# c=m.bind(cfg.server_settings["host"]+":"+cfg.server_settings["host"], "/")
289+
# r.compile()
290+
# print("r1: " + str(r._regex.pattern))
291+
# pattern = r._regex.pattern.replace('^\\|', "")
292+
# print("r1: " + str(pattern))
293+
# fin_route = pattern
294+
# route_tuple = (fin_route,cls, dispatch)
295+
# handlers.append((route_tuple,pos))
280296
else:
281297
# BETA: this regex is added to every route to make
282298
# 1.the slash at the end optional
@@ -288,8 +304,8 @@ def decorator(cls):
288304
else:
289305
fin_route = route
290306

291-
route_tuple = (fin_route,cls, dispatch)
292-
handlers.append((route_tuple,pos))
307+
route_tuple = (fin_route,cls, dispatch)
308+
handlers.append((route_tuple,pos))
293309
#print("handlers: " + str(self.handlers))
294310
print("ROUTING: added route for: " + cls.__name__ + ": " + route + " -> " + fin_route)
295311
return cls

pythononwheels/start/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import datetime
1010

1111
server_settings = {
12-
"base_url" : "http://localhost",
12+
"protocol" : "http://",
13+
"host" : "localhost",
1314
"port" : 8080,
1415
"debug" : True,
1516
"https" : False,

pythononwheels/start/tests/pow_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def test_server(self):
3131
import time
3232
p = Process(target={{appname}}.server.main)
3333
p.start()
34-
testurl=cfg.server_settings["base_url"] + ":" + str(cfg.server_settings["port"]) + "/test/12"
34+
testurl=cfg.server_settings["protocol"] + cfg.server_settings["host"] + ":" + str(cfg.server_settings["port"]) + "/test/12"
3535

3636
r = requests.get(testurl)
3737
p.terminate()

0 commit comments

Comments
 (0)