summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPepper <pepper@scannerjammer.com>2016-08-26 12:23:12 -0400
committerPepper <pepper@scannerjammer.com>2016-08-26 12:23:12 -0400
commit138498174c2dddcad6afb0f7bc125d65376e833b (patch)
tree99215ceb4f9d1fc7198676ce7aff3584ebfb802c
parent2d24e7bc8d97ae794e59ad2cf8154e66e91fe8ed (diff)
need to fix the server
-rw-r--r--photoblaster/modules/__init__.py4
-rwxr-xr-xphotoblaster/modules/pbgrid/__init__.py7
-rw-r--r--photoblaster/server.py26
3 files changed, 33 insertions, 4 deletions
diff --git a/photoblaster/modules/__init__.py b/photoblaster/modules/__init__.py
index a752281..edf4d3d 100644
--- a/photoblaster/modules/__init__.py
+++ b/photoblaster/modules/__init__.py
@@ -52,6 +52,10 @@ class ModuleBase(object):
self.width = None
self.height = None
+ #so we're in the base class right now
+ #ModuleBase
+ #and I made this private method that calls an imagemagick command
+ #you see, right? yep
def _make_canvas(self, width, height, color, filepath):
"""
makes a canvas
diff --git a/photoblaster/modules/pbgrid/__init__.py b/photoblaster/modules/pbgrid/__init__.py
index fbc027c..06454fd 100755
--- a/photoblaster/modules/pbgrid/__init__.py
+++ b/photoblaster/modules/pbgrid/__init__.py
@@ -99,9 +99,8 @@ class PbGrid(ModuleBase):
)[0]
)
- #makes a canvas file...step 1 (if not bgimage)
- def _make_canvas(self):
- super(ModuleBase, self)._make_canvas(
+ def _init_canvas(self):
+ self._make_canvas(
self.params.width or DEFAULT_WIDTH,
self.params.height or DEFAULT_HEIGHT,
self.params.bgcolor or 'transparent',
@@ -210,7 +209,7 @@ class PbGrid(ModuleBase):
self._prepare_gridimage(self.params.imageinstead)
else:
if not self.params.bgimage:
- self._make_canvas()
+ self._init_canvas()
self._grid_command()
if self.params.shadow:
self._shadow_cmd()
diff --git a/photoblaster/server.py b/photoblaster/server.py
index 5732714..bff1b24 100644
--- a/photoblaster/server.py
+++ b/photoblaster/server.py
@@ -296,6 +296,7 @@ class Server(object):
sys.stderr.write(str(request_form))
raise e
+ #and this is what I'm running locally
def run(self, host=SERVER_HOST, port=SERVER_PORT, **kwargs):
gunicorn_server = GunicornServer(
self.app,
@@ -309,6 +310,31 @@ class Server(object):
# #**kwargs
# )
+ #so this is what I'm running on the server
+ #do you know what wsgi is? it's protocol like fastcgi
+ #ok so is that different from http? well they are similar in a way, same request-response thing
+ #do you have to tell nginx to translate incoming requests from http to wsgi? yeah nginx accept http requests and
+ #pass them to location {} blocks, and there you can put then to proxy or fastcgi or wsgi app.
+ #right so is nginx changing the data at all? and can you request wsgi directly from AJAX/javascript?
+ #nginx doesn't change data itself, just repack it into different format. as for ajax, i think only http requests allowed
+ #from browser, maybe websocket requests too, but not arbitrary protocols, so it won't be possible.
+ #so cgi is http
+ #fastcgi and wsgi are a little different? yes
+ #and why is that better to change it? what makes that more efficient?
+ #cgi is basically forks a new process for each request, and that is slow. fastcgi and wsgi work about same way, it has one or more
+ #processes and inside they can be multithreaded. so everything is already initialized and ready to process actual request, this
+ #way it can handle more requests.
+ #I get it
+ #so is this multithreaded? well don't see multithreading setting here, it may be enabled by default, but need to check with docs.
+ #I see so gunicorn and cherrypy are the same thing it looks like? yeah they are wrappers that host the app.
+ #so ultimately I don't need both, right? yeah you can have same on local and remote machines.
+ #and do you notice any difference between the two?
+ #https://www.digitalocean.com/community/tutorials/a-comparison-of-web-servers-for-python-based-web-applications
+ #well they are a bit different in features, may be some of them a little faster, but they all work in same principle, so
+ #it doesn't really matter, just pick whatever you like
+ #ok
+
+ #FIXME choose one
def run_wsgi(self, server_port=SERVER_PORT, host=SERVER_HOST):
# http://fgimian.github.io/blog/2012/12/08/setting-up-a-rock-solid-python-development-web-server/
# Enable WSGI access logging via Paste