Open Side Menu Go to the Top
Register
Coding a simple server Coding a simple server

11-03-2015 , 10:51 PM
I've written some code in Python that takes a jpg image as input, saves the image to a directory and does some processing, and returns a string. I want this code to run on a server, so I can send an image from an app on my cell phone and see the string that gets returned. What's the best way to go about this? A few assumptions:

-multiple users may be sending images at the same time
-the processing time for each image is about 10-20 seconds
-the code running on the server is written in Python
-simplicity and stability are important factors

I know very little about servers so I want to ensure I'm heading down the right path before I invest a lot of time in educating myself. One suggestion I've had is to use Tornado, but I need some second opinions.
Coding a simple server Quote
11-03-2015 , 11:36 PM
11-04-2015 , 12:29 AM
Flask-gunicorn-nginx is pretty easy to set up.
Coding a simple server Quote
11-04-2015 , 08:15 PM
What are the disadvantages of implementing this with a couple lines of code using the Python socket library and a while loop?
Coding a simple server Quote
11-04-2015 , 08:22 PM
Quote:
Originally Posted by Janabis
What are the disadvantages of implementing this with a couple lines of code using the Python socket library and a while loop?
Probably won't scale up that well. The Linux epoll system call basically addressed the issue of scalability. Python might have an interface (library) that uses epoll but not sure.
Coding a simple server Quote
11-04-2015 , 11:03 PM
Does twisted library help you at all here?
Coding a simple server Quote
11-07-2015 , 03:46 AM
Quote:
Originally Posted by iosys
Did he mention that node JS is like a mini-operating system? An example of something really cool (imo) that you can do is instead of sending a file in an ajax request (which requires a slightly different form/encoding), you can send a 64 bit encoded string, decode it on the server, and use that data to reconstruct the file and save it in a folder or even send it off to a cloud image hosting site (like cloudinary). Pretty damn cool I think!

If my employer would drop this PHP nonesense, I would be in utopia with fullstack javascript!
Coding a simple server Quote
11-09-2015 , 01:33 AM
Quote:
Originally Posted by SmileyEH
Flask-gunicorn-nginx is pretty easy to set up.
Yeah this. Do not try to do anything more complicated.
Coding a simple server Quote

      
m